Move modules/other/parasite to modules/inspector
authorMatthias Clasen <mclasen@redhat.com>
Wed, 7 May 2014 03:35:47 +0000 (23:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 11 May 2014 02:04:20 +0000 (22:04 -0400)
No need for the extra subdirectory, and the name should
match the module name.

71 files changed:
configure.ac
modules/Makefile.am
modules/inspector/Makefile.am [new file with mode: 0644]
modules/inspector/button-path.c [new file with mode: 0644]
modules/inspector/button-path.h [new file with mode: 0644]
modules/inspector/button-path.ui [new file with mode: 0644]
modules/inspector/classes-list.c [new file with mode: 0644]
modules/inspector/classes-list.h [new file with mode: 0644]
modules/inspector/classes-list.ui [new file with mode: 0644]
modules/inspector/css-editor.c [new file with mode: 0644]
modules/inspector/css-editor.h [new file with mode: 0644]
modules/inspector/css-editor.ui [new file with mode: 0644]
modules/inspector/inspect-button.c [new file with mode: 0644]
modules/inspector/inspector.gresource.xml [new file with mode: 0644]
modules/inspector/module.c [new file with mode: 0644]
modules/inspector/object-hierarchy.c [new file with mode: 0644]
modules/inspector/object-hierarchy.h [new file with mode: 0644]
modules/inspector/object-hierarchy.ui [new file with mode: 0644]
modules/inspector/prop-list.c [new file with mode: 0644]
modules/inspector/prop-list.h [new file with mode: 0644]
modules/inspector/prop-list.ui [new file with mode: 0644]
modules/inspector/property-cell-renderer.c [new file with mode: 0644]
modules/inspector/property-cell-renderer.h [new file with mode: 0644]
modules/inspector/python-hooks.c [new file with mode: 0644]
modules/inspector/python-hooks.h [new file with mode: 0644]
modules/inspector/python-shell.c [new file with mode: 0644]
modules/inspector/python-shell.h [new file with mode: 0644]
modules/inspector/themes.c [new file with mode: 0644]
modules/inspector/themes.h [new file with mode: 0644]
modules/inspector/themes.ui [new file with mode: 0644]
modules/inspector/widget-tree.c [new file with mode: 0644]
modules/inspector/widget-tree.h [new file with mode: 0644]
modules/inspector/widget-tree.ui [new file with mode: 0644]
modules/inspector/window.c [new file with mode: 0644]
modules/inspector/window.h [new file with mode: 0644]
modules/inspector/window.ui [new file with mode: 0644]
modules/other/Makefile.am [deleted file]
modules/other/parasite/Makefile.am [deleted file]
modules/other/parasite/button-path.c [deleted file]
modules/other/parasite/button-path.h [deleted file]
modules/other/parasite/button-path.ui [deleted file]
modules/other/parasite/classes-list.c [deleted file]
modules/other/parasite/classes-list.h [deleted file]
modules/other/parasite/classes-list.ui [deleted file]
modules/other/parasite/css-editor.c [deleted file]
modules/other/parasite/css-editor.h [deleted file]
modules/other/parasite/css-editor.ui [deleted file]
modules/other/parasite/inspect-button.c [deleted file]
modules/other/parasite/inspector.gresource.xml [deleted file]
modules/other/parasite/module.c [deleted file]
modules/other/parasite/object-hierarchy.c [deleted file]
modules/other/parasite/object-hierarchy.h [deleted file]
modules/other/parasite/object-hierarchy.ui [deleted file]
modules/other/parasite/prop-list.c [deleted file]
modules/other/parasite/prop-list.h [deleted file]
modules/other/parasite/prop-list.ui [deleted file]
modules/other/parasite/property-cell-renderer.c [deleted file]
modules/other/parasite/property-cell-renderer.h [deleted file]
modules/other/parasite/python-hooks.c [deleted file]
modules/other/parasite/python-hooks.h [deleted file]
modules/other/parasite/python-shell.c [deleted file]
modules/other/parasite/python-shell.h [deleted file]
modules/other/parasite/themes.c [deleted file]
modules/other/parasite/themes.h [deleted file]
modules/other/parasite/themes.ui [deleted file]
modules/other/parasite/widget-tree.c [deleted file]
modules/other/parasite/widget-tree.h [deleted file]
modules/other/parasite/widget-tree.ui [deleted file]
modules/other/parasite/window.c [deleted file]
modules/other/parasite/window.h [deleted file]
modules/other/parasite/window.ui [deleted file]

index 195d8747ab0cb7b51d6fe7c1b97658b058945289..694c9f6d081e4b5dce4b0f983b3307d090a229ee 100644 (file)
@@ -1898,8 +1898,7 @@ modules/printbackends/lpr/Makefile
 modules/printbackends/file/Makefile
 modules/printbackends/papi/Makefile
 modules/printbackends/test/Makefile
-modules/other/Makefile
-modules/other/parasite/Makefile
+modules/inspector/Makefile
 ])
 
 AC_OUTPUT
index 34b26acf36f23ec3009dca4c469356c524c11e1a..f0649d18b7a741185c12731d64ad5ce0dd7a15d7 100644 (file)
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.decl
 
-SUBDIRS = input other
+SUBDIRS = input inspector
 
 if OS_UNIX
 SUBDIRS += printbackends
diff --git a/modules/inspector/Makefile.am b/modules/inspector/Makefile.am
new file mode 100644 (file)
index 0000000..97dcd32
--- /dev/null
@@ -0,0 +1,69 @@
+moduledir = $(libdir)/gtk-3.0/modules
+
+module_LTLIBRARIES = libgtkinspector.la
+
+resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/inspector.gresource.xml)
+resources.h: inspector.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
+               --target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-header --manual-register
+resources.c: inspector.gresource.xml $(resource_files)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
+               --target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-source --manual-register
+
+BUILT_SOURCES = \
+       resources.h \
+       resources.c
+
+libgtkinspector_la_SOURCES = \
+       resources.h \
+       resources.c \
+       inspect-button.c \
+       module.c \
+       prop-list.h \
+       prop-list.c \
+       property-cell-renderer.h \
+       property-cell-renderer.c \
+       python-hooks.h \
+       python-hooks.c \
+       python-shell.h \
+       python-shell.c \
+       widget-tree.h \
+       widget-tree.c \
+       window.h \
+       window.c \
+       button-path.h \
+       button-path.c \
+       classes-list.h \
+       classes-list.c \
+       css-editor.h \
+       css-editor.c \
+       object-hierarchy.h \
+       object-hierarchy.c \
+       themes.h \
+       themes.c
+
+libgtkinspector_la_CPPFLAGS = \
+       -I$(top_srcdir)                 \
+       -I$(top_srcdir)/gtk             \
+       -I$(top_builddir)/gtk           \
+       -I$(top_srcdir)/gdk             \
+       -I$(top_builddir)/gdk           \
+       -DGTK_DATADIR=\"$(datadir)\"    \
+       -DGTK_COMPILATION               \
+       $(GTK_DEP_CFLAGS)               \
+       $(GTK_DEBUG_FLAGS)
+
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
+
+libgtkinspector_la_LDFLAGS = -avoid-version -module $(no_undefined)
+
+libgtkinspector_la_LIBADD = \
+       $(top_builddir)/gtk/libgtk-3.la \
+       $(GTK_DEP_LIBS)
+
+EXTRA_DIST= \
+       $(resource_files)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/inspector/button-path.c b/modules/inspector/button-path.c
new file mode 100644 (file)
index 0000000..339d4a1
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "button-path.h"
+
+struct _GtkInspectorButtonPathPrivate
+{
+  GtkWidget *sw;
+  GtkWidget *button_box;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorButtonPath, gtk_inspector_button_path, GTK_TYPE_BOX)
+
+static void
+gtk_inspector_button_path_init (GtkInspectorButtonPath *bp)
+{
+  bp->priv = gtk_inspector_button_path_get_instance_private (bp);
+  gtk_widget_init_template (GTK_WIDGET (bp));
+}
+
+static void
+gtk_inspector_button_path_class_init (GtkInspectorButtonPathClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/button-path.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorButtonPath, sw);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorButtonPath, button_box);
+}
+
+GtkWidget *
+gtk_inspector_button_path_new (void)
+{
+  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_BUTTON_PATH, NULL));
+}
+
+void
+gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
+                                      GtkWidget          *widget)
+{
+  gchar *path, **words;
+  gint i;
+  GtkWidget *b;
+  GtkContainer *box = GTK_CONTAINER (bp->priv->button_box);
+
+  gtk_container_foreach (box, (GtkCallback)gtk_widget_destroy, NULL);
+
+  path = gtk_widget_path_to_string (gtk_widget_get_path (widget));
+  words = g_strsplit (path, " ", 0);
+
+  for (i = 0; i < g_strv_length (words); i++)
+    {
+      b = gtk_button_new_with_label (words[i]);
+      gtk_widget_show (b);
+      gtk_container_add (box, b);
+    }
+
+  g_strfreev (words);
+  g_free (path);
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/button-path.h b/modules/inspector/button-path.h
new file mode 100644 (file)
index 0000000..32f3d93
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_BUTTON_PATH_H_
+#define _GTK_INSPECTOR_BUTTON_PATH_H_
+
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_BUTTON_PATH            (gtk_inspector_button_path_get_type())
+#define GTK_INSPECTOR_BUTTON_PATH(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPath))
+#define GTK_INSPECTOR_BUTTON_PATH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPathClass))
+#define GTK_INSPECTOR_IS_BUTTON_PATH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH))
+#define GTK_INSPECTOR_IS_BUTTON_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_BUTTON_PATH))
+#define GTK_INSPECTOR_BUTTON_PATH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPathClass))
+
+
+typedef struct _GtkInspectorButtonPathPrivate GtkInspectorButtonPathPrivate;
+
+typedef struct _GtkInspectorButtonPath
+{
+  GtkBox parent;
+  GtkInspectorButtonPathPrivate *priv;
+} GtkInspectorButtonPath;
+
+typedef struct _GtkInspectorButtonPathClass
+{
+  GtkBoxClass parent;
+} GtkInspectorButtonPathClass;
+
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_button_path_get_type   (void);
+GtkWidget *gtk_inspector_button_path_new        (void);
+void       gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
+                                                 GtkWidget              *widget);
+
+G_END_DECLS
+
+
+#endif // _GTK_INSPECTOR_BUTTON_PATH_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/button-path.ui b/modules/inspector/button-path.ui
new file mode 100644 (file)
index 0000000..e4addfb
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkInspectorButtonPath" parent="GtkBox">
+    <property name="orientation">horizontal</property>
+    <child>
+      <object class="GtkScrolledWindow" id="sw">
+        <property name="visible">True</property>
+        <property name="hscrollbar-policy">automatic</property>
+        <property name="vscrollbar-policy">never</property>
+        <property name="hexpand">True</property>
+        <child>
+          <object class="GtkButtonBox" id="button_box">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="hexpand">True</property>
+            <property name="margin">6</property>
+            <property name="spacing">0</property>
+            <property name="layout-style">start</property>
+            <style>
+              <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="label">Choose a widget through the inspector</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0.5</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/classes-list.c b/modules/inspector/classes-list.c
new file mode 100644 (file)
index 0000000..86d078e
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "classes-list.h"
+
+enum
+{
+  COLUMN_ENABLED,
+  COLUMN_NAME,
+  COLUMN_STYLE
+};
+
+typedef struct
+{
+  gboolean enabled;
+  PangoStyle style;
+} GtkInspectorClassesListByContext;
+
+struct _GtkInspectorClassesListPrivate
+{
+  GtkWidget *toolbar;
+  GtkWidget *view;
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *name_renderer;
+  GtkListStore *model;
+  GHashTable *contexts;
+  GtkStyleContext *current_context;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorClassesList, gtk_inspector_classes_list, GTK_TYPE_BOX)
+
+static void
+enabled_toggled (GtkCellRendererToggle   *renderer,
+                 const gchar             *path,
+                 GtkInspectorClassesList *cl)
+{
+  GtkTreeIter iter;
+  gboolean enabled;
+  GHashTable *context;
+  GtkInspectorClassesListByContext *c;
+  gchar *name;
+
+  if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (cl->priv->model), &iter, path))
+    {
+      g_warning ("GtkInspector: Couldn't find the css class path for %s.", path);
+      return;
+    }
+
+  gtk_tree_model_get (GTK_TREE_MODEL (cl->priv->model), &iter,
+                      COLUMN_ENABLED, &enabled,
+                      COLUMN_NAME, &name,
+                      -1);
+  enabled = !enabled;
+  gtk_list_store_set (cl->priv->model, &iter,
+                      COLUMN_ENABLED, enabled,
+                      -1);
+
+  context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
+  if (context)
+    {
+      c = g_hash_table_lookup (context, name);
+      if (c)
+        {
+          c->enabled = enabled;
+          if (enabled)
+            gtk_style_context_add_class (cl->priv->current_context, name);
+          else
+            gtk_style_context_remove_class (cl->priv->current_context, name);
+        }
+      else
+        g_warning ("GtkInspector: Couldn't find the css class %s in the class hash table.", name);
+    }
+  else
+    g_warning ("GtkInspector: Couldn't find the hash table for the style context for css class %s.", name);
+}
+
+static void
+add_clicked (GtkButton               *button,
+             GtkInspectorClassesList *cl)
+{
+  GtkWidget *dialog, *content_area, *entry;
+
+  dialog = gtk_dialog_new_with_buttons ("New class",
+                                        GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (cl))),
+                                         GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
+                                         "_OK", GTK_RESPONSE_OK,
+                                         "Cancel", GTK_RESPONSE_CANCEL,
+                                         NULL);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+  entry = g_object_new (GTK_TYPE_ENTRY,
+                        "visible", TRUE,
+                        "margin", 5,
+                        "placeholder-text", "Class name",
+                        "activates-default", TRUE,
+                        NULL);
+  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+  gtk_container_add (GTK_CONTAINER (content_area), entry);
+
+  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+    {
+      const gchar *name = gtk_entry_get_text (GTK_ENTRY (entry));
+      GHashTable *context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
+
+      if (*name && !g_hash_table_contains (context, name))
+        {
+          GtkTreeIter tree_iter;
+
+          gtk_style_context_add_class (cl->priv->current_context, name);
+
+          GtkInspectorClassesListByContext *c = g_new0 (GtkInspectorClassesListByContext, 1);
+          c->enabled = TRUE;
+          c->style = PANGO_STYLE_ITALIC;
+          g_hash_table_insert (context, (gpointer)g_strdup (name), c);
+
+          gtk_list_store_append (cl->priv->model, &tree_iter);
+          gtk_list_store_set (cl->priv->model, &tree_iter,
+                             COLUMN_ENABLED, TRUE,
+                             COLUMN_NAME, name,
+                             COLUMN_STYLE, PANGO_STYLE_ITALIC,
+                            -1);
+        }
+    }
+
+  gtk_widget_destroy (dialog);
+}
+
+static void
+read_classes_from_style_context (GtkInspectorClassesList *cl)
+{
+  GList *l, *classes;
+  GtkInspectorClassesListByContext *c;
+  GtkTreeIter tree_iter;
+  GHashTable *hash_context;
+
+  hash_context = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  classes = gtk_style_context_list_classes (cl->priv->current_context);
+
+  for (l = classes; l; l = l->next)
+    {
+      c = g_new0 (GtkInspectorClassesListByContext, 1);
+      c->enabled = TRUE;
+      g_hash_table_insert (hash_context, g_strdup (l->data), c);
+
+      gtk_list_store_append (cl->priv->model, &tree_iter);
+      gtk_list_store_set (cl->priv->model, &tree_iter,
+                          COLUMN_ENABLED, TRUE,
+                          COLUMN_NAME, l->data,
+                          COLUMN_STYLE, PANGO_STYLE_NORMAL,
+                          -1);
+    }
+    g_list_free (classes);
+    g_hash_table_replace (cl->priv->contexts, cl->priv->current_context, hash_context);
+}
+
+static void
+restore_defaults_clicked (GtkButton           *button,
+                          GtkInspectorClassesList *cl)
+{
+  GHashTableIter hash_iter;
+  gchar *name;
+  GtkInspectorClassesListByContext *c;
+  GHashTable *hash_context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
+
+  g_hash_table_iter_init (&hash_iter, hash_context);
+  while (g_hash_table_iter_next (&hash_iter, (gpointer *)&name, (gpointer *)&c))
+    {
+      if (c->style == PANGO_STYLE_ITALIC)
+        gtk_style_context_remove_class (cl->priv->current_context, name);
+      else if (!c->enabled)
+        gtk_style_context_add_class (cl->priv->current_context, name);
+    }
+
+  gtk_list_store_clear (cl->priv->model);
+  read_classes_from_style_context (cl);
+}
+
+static void
+gtk_inspector_classes_list_init (GtkInspectorClassesList *cl)
+{
+  cl->priv = gtk_inspector_classes_list_get_instance_private (cl);
+  gtk_widget_init_template (GTK_WIDGET (cl));
+  cl->priv->contexts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)g_hash_table_destroy);
+}
+
+void
+gtk_inspector_classes_list_set_widget (GtkInspectorClassesList *cl,
+                                       GtkWidget               *widget)
+{
+  GtkStyleContext *widget_context;
+  GHashTable *hash_context;
+  GtkTreeIter tree_iter;
+  GtkInspectorClassesListByContext *c;
+
+  gtk_list_store_clear (cl->priv->model);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (cl), TRUE);
+  widget_context = gtk_widget_get_style_context (widget);
+
+  cl->priv->current_context = widget_context;
+  gtk_widget_set_sensitive (cl->priv->toolbar, TRUE);
+
+  hash_context = g_hash_table_lookup (cl->priv->contexts, widget_context);
+  if (hash_context)
+    {
+      GHashTableIter hash_iter;
+      gchar *name;
+
+      g_hash_table_iter_init (&hash_iter, hash_context);
+      while (g_hash_table_iter_next (&hash_iter, (gpointer *)&name, (gpointer *)&c))
+        {
+          gtk_list_store_append (cl->priv->model, &tree_iter);
+          gtk_list_store_set (cl->priv->model, &tree_iter,
+                             COLUMN_ENABLED, c->enabled,
+                             COLUMN_NAME, name,
+                             COLUMN_STYLE, c->style,
+                            -1);
+        }
+    }
+  else
+    {
+      read_classes_from_style_context (cl);
+    }
+}
+
+static void
+gtk_inspector_classes_list_class_init (GtkInspectorClassesListClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/classes-list.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, toolbar);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, view);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, column);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, name_renderer);
+  gtk_widget_class_bind_template_callback (widget_class, add_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, restore_defaults_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, enabled_toggled);
+}
+
+GtkWidget *
+gtk_inspector_classes_list_new (void)
+{
+  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_CLASSES_LIST, NULL));
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/classes-list.h b/modules/inspector/classes-list.h
new file mode 100644 (file)
index 0000000..6dfc0db
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef _GTK_INSPECTOR_CLASSES_LIST_H_
+#define _GTK_INSPECTOR_CLASSES_LIST_H_
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_CLASSES_LIST            (gtk_inspector_classes_list_get_type())
+#define GTK_INSPECTOR_CLASSES_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesList))
+#define GTK_INSPECTOR_CLASSES_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesListClass))
+#define GTK_INSPECTOR_IS_CLASSES_LIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST))
+#define GTK_INSPECTOR_IS_CLASSES_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CLASSES_LIST))
+#define GTK_INSPECTOR_CLASSES_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesListClass))
+
+
+typedef struct _GtkInspectorClassesListPrivate GtkInspectorClassesListPrivate;
+
+typedef struct _GtkInspectorClassesList
+{
+  GtkBox parent;
+  GtkInspectorClassesListPrivate *priv;
+} GtkInspectorClassesList;
+
+typedef struct _GtkInspectorClassesListClass
+{
+  GtkBoxClass parent;
+} GtkInspectorClassesListClass;
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_classes_list_get_type   (void);
+GtkWidget *gtk_inspector_classes_list_new        (void);
+void       gtk_inspector_classes_list_set_widget (GtkInspectorClassesList *cl,
+                                                  GtkWidget               *widget);
+
+G_END_DECLS
+
+#endif // _GTK_INSPECTOR_CLASSES_LIST_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/classes-list.ui b/modules/inspector/classes-list.ui
new file mode 100644 (file)
index 0000000..363b1ea
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkListStore" id="model">
+    <columns>
+      <column type="gboolean"/>
+      <column type="gchararray"/>
+      <column type="PangoStyle"/>
+    </columns>
+  </object>
+  <template class="GtkInspectorClassesList" parent="GtkBox">
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkToolbar" id="toolbar">
+        <property name="visible">True</property>
+        <property name="icon-size">small-toolbar</property>
+        <property name="sensitive">False</property>
+        <child>
+          <object class="GtkToolButton">
+            <property name="visible">True</property>
+            <property name="icon-name">list-add</property>
+            <property name="tooltip-text">Add a class</property>
+            <signal name="clicked" handler="add_clicked"/>
+          </object>
+        </child>
+        <child>
+          <object class="GtkToolButton">
+            <property name="visible">True</property>
+            <property name="icon-name">document-revert</property>
+            <property name="tooltip-text">Restore defaults for this widget</property>
+            <signal name="clicked" handler="restore_defaults_clicked"/>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="expand">True</property>
+        <child>
+          <object class="GtkTreeView" id="view">
+            <property name="visible">True</property>
+            <property name="model">model</property>
+            <child>
+              <object class="GtkTreeViewColumn" id="column">
+                <property name="title">Name</property>
+                <child>
+                  <object class="GtkCellRendererToggle">
+                    <signal name="toggled" handler="enabled_toggled"/>
+                  </object>
+                  <attributes>
+                    <attribute name="active">0</attribute>
+                  </attributes>
+                </child>
+                <child>
+                  <object class="GtkCellRendererText" id="name_renderer">
+                    <property name="scale">0.8</property>
+                  </object>
+                  <attributes>
+                    <attribute name="text">1</attribute>
+                    <attribute name="style">2</attribute>
+                  </attributes>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/css-editor.c b/modules/inspector/css-editor.c
new file mode 100644 (file)
index 0000000..e7f6a8c
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "css-editor.h"
+
+#define GTK_INSPECTOR_CSS_EDITOR_TEXT "inspector-css-editor-text"
+#define GTK_INSPECTOR_CSS_EDITOR_PROVIDER "inspector-css-editor-provider"
+
+enum
+{
+  COLUMN_ENABLED,
+  COLUMN_NAME,
+  COLUMN_USER
+};
+
+enum
+{
+  PROP_0,
+  PROP_GLOBAL
+};
+
+typedef struct
+{
+  gboolean enabled;
+  gboolean user;
+} GtkInspectorCssEditorByContext;
+
+struct _GtkInspectorCssEditorPrivate
+{
+  GtkWidget *toolbar;
+  GtkWidget *view;
+  GtkTextBuffer *text;
+  GtkCssProvider *provider;
+  gboolean global;
+  GtkStyleContext *selected_context;
+  GtkToggleToolButton *disable_button;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorCssEditor, gtk_inspector_css_editor, GTK_TYPE_BOX)
+
+static void
+set_initial_text (GtkInspectorCssEditor *editor)
+{
+  const gchar *initial_text_global =
+    "/*\n"
+    "You can type here any CSS rule recognized by GTK+.\n"
+    "You can temporarily disable this custom CSS by clicking on the \"Pause\" button above.\n\n"
+    "Changes are applied instantly and globally, for the whole application.\n"
+    "*/\n\n";
+  const gchar *initial_text_widget =
+    "/*\n"
+    "You can type here any CSS rule recognized by GTK+.\n"
+    "You can temporarily disable this custom CSS by clicking on the \"Pause\" button above.\n\n"
+    "Changes are applied instantly, only for this selected widget.\n"
+    "*/\n\n";
+  const gchar *text = NULL;
+
+  if (editor->priv->selected_context)
+    text = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_TEXT);
+  if (text)
+    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), text, -1);
+  else if (editor->priv->global)
+    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text_global, -1);
+  else
+    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text_widget, -1);
+}
+
+static void
+disable_toggled (GtkToggleToolButton   *button,
+                 GtkInspectorCssEditor *editor)
+{
+  if (gtk_toggle_tool_button_get_active (button))
+    {
+      if (editor->priv->global)
+        gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
+                                                      GTK_STYLE_PROVIDER (editor->priv->provider));
+      else if (editor->priv->selected_context)
+        gtk_style_context_remove_provider (editor->priv->selected_context,
+                                           GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER)));
+    }
+  else
+    {
+      if (editor->priv->global)
+        gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                                   GTK_STYLE_PROVIDER (editor->priv->provider),
+                                                   GTK_STYLE_PROVIDER_PRIORITY_USER);
+      else if (editor->priv->selected_context)
+        gtk_style_context_add_provider (editor->priv->selected_context,
+                                        GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER)),
+                                        G_MAXUINT);
+    }
+}
+
+static void
+apply_system_font (GtkInspectorCssEditor *editor)
+{
+  GSettings *s = g_settings_new ("org.gnome.desktop.interface");
+  gchar *font_name = g_settings_get_string (s, "monospace-font-name");
+  PangoFontDescription *font_desc = pango_font_description_from_string (font_name);
+
+  gtk_widget_override_font (editor->priv->view, font_desc);
+
+  pango_font_description_free (font_desc);
+  g_free (font_name);
+  g_object_unref (s);
+}
+
+static gchar *
+get_current_text (GtkTextBuffer *buffer)
+{
+  GtkTextIter start, end;
+
+  gtk_text_buffer_get_start_iter (buffer, &start);
+  gtk_text_buffer_get_end_iter (buffer, &end);
+  gtk_text_buffer_remove_all_tags (buffer, &start, &end);
+
+  return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+}
+
+static void
+text_changed (GtkTextBuffer         *buffer,
+              GtkInspectorCssEditor *editor)
+{
+  GtkCssProvider *provider;
+  gchar *text;
+
+  if (editor->priv->global)
+    provider = editor->priv->provider;
+  else if (editor->priv->selected_context)
+    provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
+  else
+    return;
+
+  text = get_current_text (buffer);
+  gtk_css_provider_load_from_data (provider, text, -1, NULL);
+  g_free (text);
+
+  gtk_style_context_reset_widgets (gdk_screen_get_default ());
+}
+
+static void
+show_parsing_error (GtkCssProvider        *provider,
+                    GtkCssSection         *section,
+                    const GError          *error,
+                    GtkInspectorCssEditor *editor)
+{
+  GtkTextIter start, end;
+  const char *tag_name;
+  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (editor->priv->text);
+
+  gtk_text_buffer_get_iter_at_line_index (buffer,
+                                          &start,
+                                          gtk_css_section_get_start_line (section),
+                                          gtk_css_section_get_start_position (section));
+  gtk_text_buffer_get_iter_at_line_index (buffer,
+                                          &end,
+                                          gtk_css_section_get_end_line (section),
+                                          gtk_css_section_get_end_position (section));
+
+  if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
+    tag_name = "warning";
+  else
+    tag_name = "error";
+
+  gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
+}
+
+static void
+create_provider (GtkInspectorCssEditor *editor)
+{
+  GtkCssProvider *provider = gtk_css_provider_new ();
+
+  if (editor->priv->global)
+    {
+      editor->priv->provider = provider;
+      gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                                 GTK_STYLE_PROVIDER (editor->priv->provider),
+                                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
+    }
+  else if (editor->priv->selected_context)
+    {
+      gtk_style_context_add_provider (editor->priv->selected_context,
+                                      GTK_STYLE_PROVIDER (provider),
+                                      G_MAXUINT);
+      g_object_set_data (G_OBJECT (editor->priv->selected_context),
+                         GTK_INSPECTOR_CSS_EDITOR_PROVIDER, provider);
+    }
+
+  g_signal_connect (provider, "parsing-error",
+                    G_CALLBACK (show_parsing_error), editor);
+}
+
+static void
+gtk_inspector_css_editor_init (GtkInspectorCssEditor *editor)
+{
+  editor->priv = gtk_inspector_css_editor_get_instance_private (editor);
+  gtk_widget_init_template (GTK_WIDGET (editor));
+}
+
+static void
+constructed (GObject *object)
+{
+  GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (editor), editor->priv->global);
+  create_provider (editor);
+  apply_system_font (editor);
+  set_initial_text (editor);
+}
+
+static void
+get_property (GObject    *object,
+              guint       param_id,
+              GValue     *value,
+              GParamSpec *pspec)
+{
+  GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
+
+  switch (param_id)
+    {
+      case PROP_GLOBAL:
+        g_value_set_boolean (value, editor->priv->global);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+        break;
+    }
+}
+
+static void
+set_property (GObject      *object,
+              guint         param_id,
+              const GValue *value,
+              GParamSpec   *pspec)
+{
+  GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
+
+  switch (param_id)
+    {
+      case PROP_GLOBAL:
+        editor->priv->global = g_value_get_boolean (value);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+        break;
+    }
+}
+
+static void
+gtk_inspector_css_editor_class_init (GtkInspectorCssEditorClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->get_property = get_property;
+  object_class->set_property = set_property;
+  object_class->constructed = constructed;
+
+  g_object_class_install_property (object_class, PROP_GLOBAL,
+      g_param_spec_boolean ("global", "Global", "Whether this editor changes the whole application or just the selected widget",
+                            TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/css-editor.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, toolbar);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, text);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, view);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, disable_button);
+  gtk_widget_class_bind_template_callback (widget_class, disable_toggled);
+  gtk_widget_class_bind_template_callback (widget_class, text_changed);
+}
+
+GtkWidget *
+gtk_inspector_css_editor_new (gboolean global)
+{
+  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_CSS_EDITOR,
+                                   "global", global,
+                                   NULL));
+}
+
+void
+gtk_inspector_css_editor_set_widget (GtkInspectorCssEditor *editor,
+                                     GtkWidget             *widget)
+{
+  gchar *text;
+  GtkCssProvider *provider;
+
+  g_return_if_fail (GTK_INSPECTOR_IS_CSS_EDITOR (editor));
+  g_return_if_fail (!editor->priv->global);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
+
+  if (editor->priv->selected_context)
+    {
+      text = get_current_text (GTK_TEXT_BUFFER (editor->priv->text));
+      g_object_set_data_full (G_OBJECT (editor->priv->selected_context),
+                              GTK_INSPECTOR_CSS_EDITOR_TEXT,
+                              text,
+                              g_free);
+    }
+
+  editor->priv->selected_context = gtk_widget_get_style_context (widget);
+
+  provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
+  if (!provider)
+    create_provider (editor);
+
+  set_initial_text (editor);
+  disable_toggled (editor->priv->disable_button, editor);
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/css-editor.h b/modules/inspector/css-editor.h
new file mode 100644 (file)
index 0000000..80be309
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef _GTK_INSPECTOR_CSS_EDITOR_H_
+#define _GTK_INSPECTOR_CSS_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_CSS_EDITOR            (gtk_inspector_css_editor_get_type())
+#define GTK_INSPECTOR_CSS_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditor))
+#define GTK_INSPECTOR_CSS_EDITOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditorClass))
+#define GTK_INSPECTOR_IS_CSS_EDITOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR))
+#define GTK_INSPECTOR_IS_CSS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CSS_EDITOR))
+#define GTK_INSPECTOR_CSS_EDITOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditorClass))
+
+
+typedef struct _GtkInspectorCssEditorPrivate GtkInspectorCssEditorPrivate;
+
+typedef struct _GtkInspectorCssEditor
+{
+  GtkBox parent;
+  GtkInspectorCssEditorPrivate *priv;
+} GtkInspectorCssEditor;
+
+typedef struct _GtkInspectorCssEditorClass
+{
+  GtkBoxClass parent;
+} GtkInspectorCssEditorClass;
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_css_editor_get_type   (void);
+GtkWidget *gtk_inspector_css_editor_new        (gboolean               global);
+void       gtk_inspector_css_editor_set_widget (GtkInspectorCssEditor *editor,
+                                                GtkWidget             *widget);
+
+G_END_DECLS
+
+#endif // _GTK_INSPECTOR_CSS_EDITOR_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/css-editor.ui b/modules/inspector/css-editor.ui
new file mode 100644 (file)
index 0000000..7987d8a
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkTextTagTable" id="tags">
+    <child type="tag">
+      <object class="GtkTextTag">
+        <property name="name">warning</property>
+        <property name="underline">single</property>
+      </object>
+      <object class="GtkTextTag">
+        <property name="name">error</property>
+        <property name="underline">error</property>
+      </object>
+    </child>
+  </object>
+  <object class="GtkTextBuffer" id="text">
+    <property name="tag-table">tags</property>
+    <signal name="changed" handler="text_changed"/>
+  </object>
+  <template class="GtkInspectorCssEditor" parent="GtkBox">
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkToolbar" id="toolbar">
+        <property name="visible">True</property>
+        <property name="icon-size">small-toolbar</property>
+        <child>
+          <object class="GtkToggleToolButton" id="disable_button">
+            <property name="visible">True</property>
+            <property name="icon-name">media-playback-pause</property>
+            <property name="tooltip-text">Disable this custom CSS</property>
+            <signal name="toggled" handler="disable_toggled"/>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="expand">True</property>
+        <child>
+          <object class="GtkTextView" id="view">
+            <property name="visible">True</property>
+            <property name="buffer">text</property>
+            <property name="wrap-mode">word</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/inspect-button.c b/modules/inspector/inspect-button.c
new file mode 100644 (file)
index 0000000..6c6fbb5
--- /dev/null
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "window.h"
+#include "widget-tree.h"
+
+typedef struct
+{
+  gint x;
+  gint y;
+  gboolean found;
+  gboolean first;
+  GtkWidget *res_widget;
+} FindWidgetData;
+
+static void
+find_widget (GtkWidget      *widget,
+             FindWidgetData *data)
+{
+  GtkAllocation new_allocation;
+  gint x_offset = 0;
+  gint y_offset = 0;
+
+  gtk_widget_get_allocation (widget, &new_allocation);
+
+  if (data->found || !gtk_widget_get_mapped (widget))
+    return;
+
+  /* Note that in the following code, we only count the
+   * position as being inside a WINDOW widget if it is inside
+   * widget->window; points that are outside of widget->window
+   * but within the allocation are not counted. This is consistent
+   * with the way we highlight drag targets.
+   */
+  if (gtk_widget_get_has_window (widget))
+    {
+      new_allocation.x = 0;
+      new_allocation.y = 0;
+    }
+
+  if (gtk_widget_get_parent (widget) && !data->first)
+    {
+      GdkWindow *window = gtk_widget_get_window (widget);
+      while (window != gtk_widget_get_window (gtk_widget_get_parent (widget)))
+        {
+          gint tx, ty, twidth, theight;
+
+          twidth = gdk_window_get_width (window);
+          theight = gdk_window_get_height (window);
+
+          if (new_allocation.x < 0)
+            {
+              new_allocation.width += new_allocation.x;
+              new_allocation.x = 0;
+            }
+          if (new_allocation.y < 0)
+            {
+              new_allocation.height += new_allocation.y;
+              new_allocation.y = 0;
+            }
+          if (new_allocation.x + new_allocation.width > twidth)
+            new_allocation.width = twidth - new_allocation.x;
+          if (new_allocation.y + new_allocation.height > theight)
+            new_allocation.height = theight - new_allocation.y;
+
+          gdk_window_get_position (window, &tx, &ty);
+          new_allocation.x += tx;
+          x_offset += tx;
+          new_allocation.y += ty;
+          y_offset += ty;
+
+          window = gdk_window_get_parent (window);
+        }
+    }
+
+  if ((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
+      (data->x < new_allocation.x + new_allocation.width) &&
+      (data->y < new_allocation.y + new_allocation.height))
+    {
+      /* First, check if the drag is in a valid drop site in
+       * one of our children 
+       */
+      if (GTK_IS_CONTAINER (widget))
+        {
+          FindWidgetData new_data = *data;
+
+          new_data.x -= x_offset;
+          new_data.y -= y_offset;
+          new_data.found = FALSE;
+          new_data.first = FALSE;
+
+          gtk_container_forall (GTK_CONTAINER (widget),
+                                (GtkCallback)find_widget,
+                                &new_data);
+
+          data->found = new_data.found;
+          if (data->found)
+            data->res_widget = new_data.res_widget;
+        }
+
+      /* If not, and this widget is registered as a drop site, check to
+       * emit "drag_motion" to check if we are actually in
+       * a drop site.
+       */
+      if (!data->found)
+        {
+          data->found = TRUE;
+          data->res_widget = widget;
+        }
+    }
+}
+
+static GtkWidget *
+find_widget_at_pointer (GdkDevice *device)
+{
+  GtkWidget *widget = NULL;
+  GdkWindow *pointer_window;
+  gint x, y;
+  FindWidgetData data;
+
+  pointer_window = gdk_device_get_window_at_position (device, NULL, NULL);
+
+  if (pointer_window)
+    {
+      gpointer widget_ptr;
+
+      gdk_window_get_user_data (pointer_window, &widget_ptr);
+      widget = widget_ptr;
+    }
+
+  if (widget)
+    {
+      gdk_window_get_device_position (gtk_widget_get_window (widget),
+                                      device, &x, &y, NULL);
+
+      data.x = x;
+      data.y = y;
+      data.found = FALSE;
+      data.first = TRUE;
+
+      find_widget (widget, &data);
+      if (data.found)
+        return data.res_widget;
+
+      return widget;
+    }
+
+  return NULL;
+}
+
+static gboolean draw_flash (GtkWidget          *widget,
+                            cairo_t            *cr,
+                            GtkInspectorWindow *iw);
+
+static void
+clear_flash (GtkInspectorWindow *iw)
+{
+  if (iw->flash_widget)
+    {
+      gtk_widget_queue_draw (iw->flash_widget);
+      g_signal_handlers_disconnect_by_func (iw->flash_widget, draw_flash, iw);
+      iw->flash_widget = NULL;
+    }
+}
+
+static void
+start_flash (GtkInspectorWindow *iw,
+             GtkWidget          *widget)
+{
+  iw->flash_count = 1;
+  iw->flash_widget = widget;
+  g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), iw);
+  gtk_widget_queue_draw (widget);
+}
+
+static void
+on_inspect_widget (GtkWidget          *button,
+                   GdkEvent           *event,
+                   GtkInspectorWindow *iw)
+{
+  GtkWidget *widget;
+
+  clear_flash (iw);
+
+  widget = find_widget_at_pointer (gdk_event_get_device (event));
+
+  if (widget == NULL)
+    return;
+
+  iw->selected_widget = widget;
+
+  gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
+                                  gtk_widget_get_toplevel (widget));
+
+  gtk_inspector_widget_tree_select_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
+                                           G_OBJECT (widget));
+}
+
+static void
+on_highlight_widget (GtkWidget          *button,
+                     GdkEvent           *event,
+                     GtkInspectorWindow *iw)
+{
+  GtkWidget *widget;
+
+  widget = find_widget_at_pointer (gdk_event_get_device (event));
+
+  if (widget == NULL)
+    {
+      /* This window isn't in-process. Ignore it. */
+      return;
+    }
+
+  if (gtk_widget_get_toplevel (widget) == GTK_WIDGET (iw))
+    {
+      /* Don't hilight things in the inspector window */
+      return;
+    }
+
+  if (iw->flash_widget == widget)
+    {
+      /* Already selected */
+      return;
+    }
+
+  clear_flash (iw);
+  start_flash (iw, widget);
+}
+
+static gboolean
+property_query_event (GtkWidget *widget,
+                      GdkEvent  *event,
+                      gpointer   data)
+{
+  if (event->type == GDK_BUTTON_RELEASE)
+    {
+      g_signal_handlers_disconnect_by_func (widget, property_query_event, data);
+      gtk_grab_remove (widget);
+      gdk_device_ungrab (gdk_event_get_device (event), GDK_CURRENT_TIME);
+      on_inspect_widget (widget, event, data);
+    }
+  else if (event->type == GDK_MOTION_NOTIFY)
+    {
+      on_highlight_widget (widget, event, data);
+    }
+
+  return FALSE;
+}
+
+void
+on_inspect (GtkWidget          *button,
+            GtkInspectorWindow *iw)
+{
+  GdkDisplay *display;
+  GdkDevice *device;
+  GdkCursor *cursor;
+
+  g_signal_connect (button, "event",
+                    G_CALLBACK (property_query_event), iw);
+
+  display = gtk_widget_get_display (button);
+  cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
+  device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
+  gdk_device_grab (device,
+                   gtk_widget_get_window (GTK_WIDGET (button)),
+                   GDK_OWNERSHIP_NONE, TRUE,
+                   GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
+                   cursor, GDK_CURRENT_TIME);
+  g_object_unref (cursor);
+  gtk_grab_add (GTK_WIDGET (button));
+}
+
+GtkWidget *
+gtk_inspector_inspect_button_new (GtkInspectorWindow *iw)
+{
+  GtkWidget *button;
+
+  button = gtk_button_new_from_icon_name ("edit-find", GTK_ICON_SIZE_BUTTON);
+  gtk_widget_set_tooltip_text (button, "Inspect");
+  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_inspect), iw);
+
+  return button;
+}
+
+static gboolean
+draw_flash (GtkWidget          *widget,
+            cairo_t            *cr,
+            GtkInspectorWindow *iw)
+{
+  GtkAllocation alloc;
+
+  if (iw->flash_count % 2 == 0)
+    return FALSE;
+
+  if (GTK_IS_WINDOW (widget))
+    {
+      /* We don't want to draw the drag highlight around the
+       * CSD window decorations
+       */
+      gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN (widget)), &alloc);
+    }
+  else
+    {
+      alloc.x = 0;
+      alloc.y = 0;
+      alloc.width = gtk_widget_get_allocated_width (widget);
+      alloc.height = gtk_widget_get_allocated_height (widget);
+    }
+
+  cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.2);
+  cairo_rectangle (cr,
+                   alloc.x + 0.5, alloc.y + 0.5,
+                   alloc.width - 1, alloc.height - 1);
+  cairo_fill (cr);
+
+  return FALSE;
+}
+
+static gboolean
+on_flash_timeout (GtkInspectorWindow *iw)
+{
+  gtk_widget_queue_draw (iw->flash_widget);
+
+  iw->flash_count++;
+
+  if (iw->flash_count == 6)
+    {
+      g_signal_handlers_disconnect_by_func (iw->flash_widget, draw_flash, iw);
+      iw->flash_widget = NULL;
+      iw->flash_cnx = 0;
+
+      return G_SOURCE_REMOVE;
+    }
+
+  return G_SOURCE_CONTINUE;
+}
+
+void
+gtk_inspector_flash_widget (GtkInspectorWindow *iw,
+                            GtkWidget          *widget)
+{
+  if (iw->flash_cnx != 0)
+    return;
+
+  if (!gtk_widget_get_visible (widget) || !gtk_widget_get_mapped (widget))
+    return;
+
+  start_flash (iw, widget);
+  iw->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, iw);
+}
+
+/* vim: set et sw=2 ts=2: */
diff --git a/modules/inspector/inspector.gresource.xml b/modules/inspector/inspector.gresource.xml
new file mode 100644 (file)
index 0000000..145c883
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gtk/inspector">
+    <file>button-path.ui</file>
+    <file>object-hierarchy.ui</file>
+    <file>css-editor.ui</file>
+    <file>classes-list.ui</file>
+    <file>widget-tree.ui</file>
+    <file>prop-list.ui</file>
+    <file>themes.ui</file>
+    <file>window.ui</file>
+  </gresource>
+</gresources>
diff --git a/modules/inspector/module.c b/modules/inspector/module.c
new file mode 100644 (file)
index 0000000..2195d03
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include <glib.h>
+
+#include "button-path.h"
+#include "classes-list.h"
+#include "css-editor.h"
+#include "object-hierarchy.h"
+#include "property-cell-renderer.h"
+#include "prop-list.h"
+#include "python-hooks.h"
+#include "python-shell.h"
+#include "resources.h"
+#include "themes.h"
+#include "widget-tree.h"
+#include "window.h"
+
+void
+gtk_module_init (gint *argc, gchar ***argv)
+{
+#ifdef ENABLE_PYTHON
+  gtk_inspector_python_init ();
+#endif
+
+  gtk_inspector_register_resource ();
+
+  g_type_ensure (GTK_TYPE_INSPECTOR_THEMES);
+  g_type_ensure (GTK_TYPE_INSPECTOR_CSS_EDITOR);
+  g_type_ensure (GTK_TYPE_INSPECTOR_BUTTON_PATH);
+  g_type_ensure (GTK_TYPE_INSPECTOR_WIDGET_TREE);
+  g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST);
+  g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY);
+  g_type_ensure (GTK_TYPE_INSPECTOR_CLASSES_LIST);
+  g_type_ensure (GTK_TYPE_INSPECTOR_PYTHON_SHELL);
+  g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
+  g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
+}
+
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/object-hierarchy.c b/modules/inspector/object-hierarchy.c
new file mode 100644 (file)
index 0000000..71af2bf
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "object-hierarchy.h"
+
+enum
+{
+  COLUMN_OBJECT_NAME
+};
+
+struct _GtkInspectorObjectHierarchyPrivate
+{
+  GtkTreeStore *model;
+  GtkTreeView *tree;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
+
+static void
+gtk_inspector_object_hierarchy_init (GtkInspectorObjectHierarchy *oh)
+{
+  oh->priv = gtk_inspector_object_hierarchy_get_instance_private (oh);
+  gtk_widget_init_template (GTK_WIDGET (oh));
+}
+
+static void
+gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/object-hierarchy.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
+}
+
+GtkWidget *
+gtk_inspector_object_hierarchy_new (void)
+{
+  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, NULL));
+}
+
+void
+gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
+                                           GObject                     *object)
+{
+  GObjectClass *klass = G_OBJECT_GET_CLASS (object);
+  const gchar *class_name;
+  GtkTreeIter iter, parent;
+  GSList *list = NULL, *l;
+
+  gtk_tree_store_clear (oh->priv->model);
+
+  do
+    {
+      class_name = G_OBJECT_CLASS_NAME (klass);
+      list = g_slist_append (list, (gpointer)class_name);
+    }
+  while ((klass = g_type_class_peek_parent (klass)));
+  list = g_slist_reverse (list);
+
+  for (l = list; l; l = l->next)
+    {
+      gtk_tree_store_append (oh->priv->model, &iter, l == list ? NULL : &parent);
+      gtk_tree_store_set (oh->priv->model, &iter,
+                          COLUMN_OBJECT_NAME, l->data,
+                          -1);
+      parent = iter;
+    }
+
+  g_slist_free (list);
+
+  gtk_tree_view_expand_all (oh->priv->tree);
+  gtk_tree_selection_select_iter (gtk_tree_view_get_selection (oh->priv->tree), &iter);
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/object-hierarchy.h b/modules/inspector/object-hierarchy.h
new file mode 100644 (file)
index 0000000..baa4093
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
+#define _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY            (gtk_inspector_object_hierarchy_get_type())
+#define GTK_INSPECTOR_OBJECT_HIERARCHY(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchy))
+#define GTK_INSPECTOR_OBJECT_HIERARCHY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass))
+#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY))
+#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY))
+#define GTK_INSPECTOR_OBJECT_HIERARCHY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass))
+
+
+typedef struct _GtkInspectorObjectHierarchyPrivate GtkInspectorObjectHierarchyPrivate;
+
+typedef struct _GtkInspectorObjectHierarchy
+{
+  GtkBox parent;
+  GtkInspectorObjectHierarchyPrivate *priv;
+} GtkInspectorObjectHierarchy;
+
+typedef struct _GtkInspectorObjectHierarchyClass
+{
+  GtkBoxClass parent;
+} GtkInspectorObjectHierarchyClass;
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_object_hierarchy_get_type   (void);
+GtkWidget *gtk_inspector_object_hierarchy_new        (void);
+void       gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
+                                                      GObject                     *object);
+
+G_END_DECLS
+
+#endif // _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/object-hierarchy.ui b/modules/inspector/object-hierarchy.ui
new file mode 100644 (file)
index 0000000..04d54e1
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkTreeStore" id="model">
+    <columns>
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <template class="GtkInspectorObjectHierarchy" parent="GtkBox">
+    <property name="orientation">horizontal</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="expand">True</property>
+        <child>
+          <object class="GtkTreeView" id="tree">
+            <property name="visible">True</property>
+            <property name="model">model</property>
+            <child>
+              <object class="GtkTreeViewColumn">
+                <property name="title">Object Hierarchy</property>
+                <child>
+                  <object class="GtkCellRendererText">
+                    <property name="scale">0.8</property>
+                  </object>
+                  <attributes>
+                    <attribute name="text">0</attribute>
+                  </attributes> 
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/prop-list.c b/modules/inspector/prop-list.c
new file mode 100644 (file)
index 0000000..938ee32
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "prop-list.h"
+#include "property-cell-renderer.h"
+
+
+enum
+{
+  COLUMN_NAME,
+  COLUMN_VALUE,
+  COLUMN_DEFINED_AT,
+  COLUMN_OBJECT,
+  COLUMN_TOOLTIP,
+  COLUMN_WRITABLE
+};
+
+enum
+{
+  PROP_0,
+  PROP_WIDGET_TREE,
+  PROP_CHILD_PROPERTIES
+};
+
+struct _GtkInspectorPropListPrivate
+{
+  GObject *object;
+  GtkListStore *model;
+  GHashTable *prop_iters;
+  GList *signal_cnxs;
+  GtkWidget *widget_tree;
+  GtkCellRenderer *value_renderer;
+  gboolean child_properties;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropList, gtk_inspector_prop_list, GTK_TYPE_TREE_VIEW)
+
+static void
+gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
+{
+  pl->priv = gtk_inspector_prop_list_get_instance_private (pl);
+  gtk_widget_init_template (GTK_WIDGET (pl));
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (pl->priv->model),
+                                        COLUMN_NAME,
+                                        GTK_SORT_ASCENDING);
+  pl->priv->prop_iters = g_hash_table_new_full (g_str_hash,
+                                                g_str_equal,
+                                                NULL,
+                                                (GDestroyNotify) gtk_tree_iter_free);
+}
+
+static void
+get_property (GObject    *object,
+              guint       param_id,
+              GValue     *value,
+              GParamSpec *pspec)
+{
+  GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
+
+  switch (param_id)
+    {
+      case PROP_WIDGET_TREE:
+        g_value_take_object (value, pl->priv->widget_tree);
+        g_object_set_data (G_OBJECT (pl->priv->value_renderer), "gtk_inspector-widget-tree", pl->priv->widget_tree);
+        break;
+
+      case PROP_CHILD_PROPERTIES:
+        g_value_set_boolean (value, pl->priv->child_properties);
+        g_object_set (pl->priv->value_renderer,
+                      "is-child-property", pl->priv->child_properties,
+                      NULL);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+        break;
+    }
+}
+
+static void
+set_property (GObject      *object,
+              guint         param_id,
+              const GValue *value,
+              GParamSpec   *pspec)
+{
+  GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
+
+  switch (param_id)
+    {
+      case PROP_WIDGET_TREE:
+        pl->priv->widget_tree = g_value_get_object (value);
+        break;
+
+      case PROP_CHILD_PROPERTIES:
+        pl->priv->child_properties = g_value_get_boolean (value);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+        break;
+    }
+}
+
+static void
+gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->get_property = get_property;
+  object_class->set_property = set_property;
+
+  g_object_class_install_property (object_class, PROP_WIDGET_TREE,
+      g_param_spec_object ("widget-tree", "Widget Tree", "Widget tree",
+                           GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class, PROP_CHILD_PROPERTIES,
+      g_param_spec_boolean ("child-properties", "Child properties", "Child properties",
+                            FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/prop-list.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, model);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, value_renderer);
+}
+
+static void
+gtk_inspector_prop_list_update_prop (GtkInspectorPropList *pl,
+                                     GtkTreeIter          *iter,
+                                     GParamSpec           *prop)
+{
+  GValue gvalue = {0};
+  gchar *value;
+
+  g_value_init(&gvalue, prop->value_type);
+  if (pl->priv->child_properties)
+    {
+      GtkWidget *parent;
+
+      parent = gtk_widget_get_parent (GTK_WIDGET (pl->priv->object));
+      gtk_container_child_get_property (GTK_CONTAINER (parent),
+                                        GTK_WIDGET (pl->priv->object),
+                                        prop->name, &gvalue);
+    }
+  else
+    g_object_get_property (pl->priv->object, prop->name, &gvalue);
+
+  if (G_VALUE_HOLDS_ENUM (&gvalue))
+    {
+      GEnumClass *enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
+      GEnumValue *enum_value = g_enum_get_value (enum_class, g_value_get_enum (&gvalue));
+
+      value = g_strdup (enum_value->value_name);
+    }
+  else
+    {
+      value = g_strdup_value_contents(&gvalue);
+    }
+
+  gtk_list_store_set (pl->priv->model, iter,
+                      COLUMN_NAME, prop->name,
+                      COLUMN_VALUE, value ? value : g_strdup (""),
+                      COLUMN_DEFINED_AT, g_type_name (prop->owner_type),
+                      COLUMN_OBJECT, pl->priv->object,
+                      COLUMN_TOOLTIP, g_param_spec_get_blurb (prop),
+                      COLUMN_WRITABLE, (prop->flags & G_PARAM_WRITABLE) != 0,
+                      -1);
+
+  g_free (value);
+  g_value_unset (&gvalue);
+}
+
+static void
+gtk_inspector_prop_list_prop_changed_cb (GObject              *pspec,
+                                         GParamSpec           *prop,
+                                         GtkInspectorPropList *pl)
+{
+  GtkTreeIter *iter = g_hash_table_lookup(pl->priv->prop_iters, prop->name);
+
+  if (iter != NULL)
+    gtk_inspector_prop_list_update_prop (pl, iter, prop);
+}
+
+GtkWidget *
+gtk_inspector_prop_list_new (GtkWidget *widget_tree,
+                             gboolean   child_properties)
+{
+  g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
+
+  return g_object_new (GTK_TYPE_INSPECTOR_PROP_LIST,
+                       "widget-tree", widget_tree,
+                       "child-properties", child_properties,
+                       NULL);
+}
+
+gboolean
+gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
+                                    GObject              *object)
+{
+  GtkTreeIter iter;
+  GParamSpec **props;
+  guint num_properties;
+  guint i;
+  GList *l;
+
+  if (pl->priv->object == object)
+    return FALSE;
+
+  pl->priv->object = object;
+
+  for (l = pl->priv->signal_cnxs; l != NULL; l = l->next)
+    {
+      gulong id = GPOINTER_TO_UINT (l->data);
+
+      if (g_signal_handler_is_connected (object, id))
+        g_signal_handler_disconnect (object, id);
+    }
+
+  g_list_free (pl->priv->signal_cnxs);
+  pl->priv->signal_cnxs = NULL;
+
+  g_hash_table_remove_all (pl->priv->prop_iters);
+  gtk_list_store_clear (pl->priv->model);
+  gtk_widget_set_sensitive (GTK_WIDGET (pl), FALSE);
+
+  if (pl->priv->child_properties)
+    {
+      GtkWidget *parent;
+
+      if (!GTK_IS_WIDGET (object))
+        return TRUE;
+
+      parent = gtk_widget_get_parent (GTK_WIDGET (object));
+      if (!parent)
+        return TRUE;
+
+      props = gtk_container_class_list_child_properties (G_OBJECT_GET_CLASS (parent), &num_properties);
+    }
+  else
+    props = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &num_properties);
+
+  gtk_widget_set_sensitive (GTK_WIDGET (pl), TRUE);
+
+  for (i = 0; i < num_properties; i++)
+    {
+      GParamSpec *prop = props[i];
+      gchar *signal_name;
+
+      if (! (prop->flags & G_PARAM_READABLE))
+        continue;
+
+      gtk_list_store_append (pl->priv->model, &iter);
+      gtk_inspector_prop_list_update_prop (pl, &iter, prop);
+
+      g_hash_table_insert (pl->priv->prop_iters, (gpointer) prop->name, gtk_tree_iter_copy (&iter));
+
+      /* Listen for updates */
+      if (pl->priv->child_properties)
+        signal_name = g_strdup_printf ("child-notify::%s", prop->name);
+      else
+        signal_name = g_strdup_printf ("notify::%s", prop->name);
+
+      pl->priv->signal_cnxs =
+          g_list_prepend (pl->priv->signal_cnxs,
+                          GINT_TO_POINTER (g_signal_connect(object, signal_name,
+                                                            G_CALLBACK (gtk_inspector_prop_list_prop_changed_cb), pl)));
+
+        g_free (signal_name);
+    }
+
+  return TRUE;
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/prop-list.h b/modules/inspector/prop-list.h
new file mode 100644 (file)
index 0000000..c9dc42c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_PROP_LIST_H_
+#define _GTK_INSPECTOR_PROP_LIST_H_
+
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_PROP_LIST            (gtk_inspector_prop_list_get_type())
+#define GTK_INSPECTOR_PROP_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropList))
+#define GTK_INSPECTOR_PROP_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropListClass))
+#define GTK_INSPECTOR_IS_PROP_LIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROP_LIST))
+#define GTK_INSPECTOR_IS_PROP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROP_LIST))
+#define GTK_INSPECTOR_PROP_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropListClass))
+
+
+typedef struct _GtkInspectorPropListPrivate GtkInspectorPropListPrivate;
+
+typedef struct _GtkInspectorPropList
+{
+  GtkTreeView parent;
+  GtkInspectorPropListPrivate *priv;
+} GtkInspectorPropList;
+
+typedef struct _GtkInspectorPropListClass
+{
+  GtkTreeViewClass parent;
+} GtkInspectorPropListClass;
+
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_prop_list_get_type   (void);
+GtkWidget *gtk_inspector_prop_list_new        (GtkWidget            *widget_tree,
+                                               gboolean              child_properties);
+gboolean   gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
+                                               GObject              *object);
+
+G_END_DECLS
+
+#endif // _GTK_INSPECTOR_PROP_LIST_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/prop-list.ui b/modules/inspector/prop-list.ui
new file mode 100644 (file)
index 0000000..a3064ac
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkListStore" id="model">
+    <columns>
+      <column type="gchararray"/>
+      <column type="gchararray"/>
+      <column type="gchararray"/>
+      <column type="GObject"/>
+      <column type="gchararray"/>
+      <column type="gboolean"/>
+    </columns>
+  </object>
+  <template class="GtkInspectorPropList" parent="GtkTreeView">
+    <property name="model">model</property>
+    <property name="tooltip-column">4</property>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Property</property>
+        <property name="resizable">True</property>
+        <property name="sort-order">ascending</property>
+        <property name="sort-column-id">0</property>
+        <child>
+          <object class="GtkCellRendererText">
+            <property name="scale">0.8</property>
+          </object>
+          <attributes>
+            <attribute name="text">0</attribute>
+            <attribute name="sensitive">5</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Value</property>
+        <property name="resizable">True</property>
+        <child>
+          <object class="GtkInspectorPropertyCellRenderer" id="value_renderer">
+            <property name="scale">0.8</property>
+            <property name="editable">True</property>
+          </object>
+          <attributes>
+            <attribute name="text">1</attribute>
+            <attribute name="object">3</attribute>
+            <attribute name="name">0</attribute>
+            <attribute name="sensitive">5</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Defined At</property>
+        <child>
+          <object class="GtkCellRendererText">
+            <property name="scale">0.8</property>
+          </object>
+          <attributes>
+            <attribute name="text">2</attribute>
+            <attribute name="sensitive">5</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/property-cell-renderer.c b/modules/inspector/property-cell-renderer.c
new file mode 100644 (file)
index 0000000..a0a2cf9
--- /dev/null
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "property-cell-renderer.h"
+#include "widget-tree.h"
+
+struct _GtkInspectorPropertyCellRendererPrivate
+{
+  GObject *object;
+  char *name;
+  gboolean is_child_property;
+};
+
+enum
+{
+  PROP_0,
+  PROP_OBJECT,
+  PROP_NAME,
+  PROP_IS_CHILD_PROPERTY
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropertyCellRenderer, gtk_inspector_property_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT);
+
+static void
+gtk_inspector_property_cell_renderer_init(GtkInspectorPropertyCellRenderer *renderer)
+{
+  renderer->priv = gtk_inspector_property_cell_renderer_get_instance_private (renderer);
+}
+
+static void
+get_property (GObject    *object,
+              guint       param_id,
+              GValue     *value,
+              GParamSpec *pspec)
+{
+  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
+
+  switch (param_id)
+    {
+    case PROP_OBJECT:
+      g_value_set_object(value, r->priv->object);
+      break;
+
+    case PROP_NAME:
+      g_value_set_string(value, r->priv->name);
+      break;
+
+    case PROP_IS_CHILD_PROPERTY:
+      g_value_set_boolean (value, r->priv->is_child_property);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+    }
+}
+
+static void
+set_property (GObject      *object,
+              guint         param_id,
+              const GValue *value,
+              GParamSpec   *pspec)
+{
+  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
+
+  switch (param_id)
+    {
+    case PROP_OBJECT:
+      r->priv->object = g_value_get_object (value);
+      break;
+
+    case PROP_NAME:
+      g_free (r->priv->name);
+      r->priv->name = g_value_dup_string (value);
+      break;
+
+    case PROP_IS_CHILD_PROPERTY:
+      r->priv->is_child_property = g_value_get_boolean (value);
+      g_object_notify (object, "is-child-property");
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+    } 
+}
+
+static GParamSpec *
+find_property (GtkCellRenderer *renderer)
+{
+  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
+
+  if (r->priv->is_child_property)
+    {
+      GtkWidget *parent;
+
+      parent = gtk_widget_get_parent (GTK_WIDGET (r->priv->object));
+
+      return gtk_container_class_find_child_property (G_OBJECT_GET_CLASS (parent), r->priv->name);
+    }
+
+  return g_object_class_find_property (G_OBJECT_GET_CLASS (r->priv->object), r->priv->name);
+}
+
+static void
+get_value (GtkCellRenderer *renderer,
+           GValue          *gvalue)
+{
+  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
+
+  if (r->priv->is_child_property)
+    {
+      GtkWidget *widget;
+      GtkWidget *parent;
+
+      widget = GTK_WIDGET (r->priv->object);
+      parent = gtk_widget_get_parent (widget);
+
+      gtk_container_child_get_property (GTK_CONTAINER (parent), widget, r->priv->name, gvalue);
+    }
+  else
+    g_object_get_property (r->priv->object, r->priv->name, gvalue);
+}
+
+static void
+set_value (GtkCellRenderer *renderer,
+           GValue          *gvalue)
+{
+  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
+
+  if (r->priv->is_child_property)
+    {
+      GtkWidget *widget;
+      GtkWidget *parent;
+
+      widget = GTK_WIDGET (r->priv->object);
+      parent = gtk_widget_get_parent (widget);
+
+      gtk_container_child_set_property (GTK_CONTAINER (parent), widget, r->priv->name, gvalue);
+    }
+  else
+    g_object_set_property (r->priv->object, r->priv->name, gvalue);
+}
+
+static void
+stop_editing (GtkCellEditable *editable,
+              GtkCellRenderer *renderer)
+{
+  GValue gvalue = {0};
+  GParamSpec *prop;
+
+  prop = find_property (renderer);
+  g_value_init(&gvalue, prop->value_type);
+
+  if (GTK_IS_ENTRY(editable))
+    {
+      gboolean canceled;
+
+      g_object_get (editable, "editing-canceled", &canceled, NULL);
+      gtk_cell_renderer_stop_editing (renderer, canceled);
+
+      if (canceled)
+        return;
+
+      if (GTK_IS_SPIN_BUTTON(editable))
+        {
+          gdouble value = g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (editable)), NULL);
+
+          if (G_IS_PARAM_SPEC_INT (prop))
+            g_value_set_int (&gvalue, (gint)value);
+          else if G_IS_PARAM_SPEC_UINT (prop)
+            g_value_set_uint (&gvalue, (guint)value);
+          else if G_IS_PARAM_SPEC_INT64 (prop)
+            g_value_set_int64 (&gvalue, (gint64)value);
+          else if G_IS_PARAM_SPEC_UINT64 (prop)
+            g_value_set_uint64 (&gvalue, (guint64)value);
+          else if G_IS_PARAM_SPEC_LONG (prop)
+            g_value_set_long (&gvalue, (glong)value);
+          else if G_IS_PARAM_SPEC_ULONG (prop)
+            g_value_set_ulong (&gvalue, (gulong)value);
+          else if G_IS_PARAM_SPEC_DOUBLE (prop)
+            g_value_set_double (&gvalue, (gdouble)value);
+          else
+            return;
+        }
+      else
+        {
+          g_value_set_string (&gvalue, gtk_entry_get_text (GTK_ENTRY (editable)));
+        }
+    }
+  else if (GTK_IS_COMBO_BOX (editable))
+    {
+      /* We have no way of getting the canceled state for a GtkComboBox */
+      gtk_cell_renderer_stop_editing (renderer, FALSE);
+
+      if (G_IS_PARAM_SPEC_BOOLEAN (prop))
+        {
+          g_value_set_boolean (&gvalue, gtk_combo_box_get_active (GTK_COMBO_BOX (editable)) == 1);
+        }
+      else if (G_IS_PARAM_SPEC_ENUM (prop))
+        {
+          gchar *enum_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (editable));
+          GEnumClass *enum_class;
+          GEnumValue *enum_value;
+
+          if (enum_name == NULL)
+            return;
+
+          enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
+          enum_value = g_enum_get_value_by_name (enum_class, enum_name);
+          g_value_set_enum (&gvalue, enum_value->value);
+
+          g_free (enum_name);
+        }
+    }
+
+  set_value (renderer, &gvalue);
+  g_value_unset (&gvalue);
+}
+
+static GtkCellEditable *
+start_editing (GtkCellRenderer      *renderer,
+               GdkEvent             *event,
+               GtkWidget            *widget,
+               const gchar          *path,
+               const GdkRectangle   *background_area,
+               const GdkRectangle   *cell_area,
+               GtkCellRendererState  flags)
+{
+  PangoFontDescription *font_desc;
+  GtkCellEditable *editable = NULL;
+  GValue gvalue = {0};
+  GParamSpec *prop;
+  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
+
+  prop = find_property (renderer);
+
+  g_value_init (&gvalue, prop->value_type);
+
+  get_value (renderer, &gvalue);
+
+  if (G_VALUE_HOLDS_OBJECT (&gvalue))
+    {
+      GtkInspectorWidgetTree *widget_tree = g_object_get_data (G_OBJECT (renderer), "gtk_inspector-widget-tree");
+      GObject *prop_object = g_value_get_object (&gvalue);
+      GtkTreeIter iter;
+
+      if (prop_object)
+        {
+          /* First check if the value is already in the tree (happens with 'parent' for instance) */
+          if (gtk_inspector_widget_tree_find_object (widget_tree, prop_object, &iter))
+            {
+              gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
+            }
+          else if (gtk_inspector_widget_tree_find_object (widget_tree, r->priv->object, &iter))
+            {
+              gtk_inspector_widget_tree_append_object (widget_tree, prop_object, &iter);
+              gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
+            }
+          else
+            {
+              g_warning ("GtkInspector: couldn't find the widget in the tree");
+            }
+        }
+      g_value_unset (&gvalue);
+      return NULL;
+    }
+  else
+    {
+      if (!(prop->flags & G_PARAM_WRITABLE))
+        return NULL;
+
+      if (G_VALUE_HOLDS_ENUM (&gvalue) || G_VALUE_HOLDS_BOOLEAN (&gvalue))
+        {
+          GtkWidget *combobox;
+          GList *renderers;
+
+          combobox = gtk_combo_box_text_new ();
+          gtk_widget_show (combobox);
+          g_object_set (G_OBJECT (combobox), "has-frame", FALSE, NULL);
+
+          if (G_VALUE_HOLDS_BOOLEAN (&gvalue))
+            {
+              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), "FALSE");
+              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), "TRUE");
+
+              gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), g_value_get_boolean (&gvalue) ? 1 : 0);
+            }
+          else if (G_VALUE_HOLDS_ENUM(&gvalue))
+            {
+              gint value = g_value_get_enum (&gvalue);
+              GEnumClass *enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
+              guint i;
+
+              for (i = 0; i < enum_class->n_values; i++)
+                {
+                  GEnumValue *enum_value = &enum_class->values[i];
+
+                  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox),
+                                                  enum_value->value_name);
+
+                  if (enum_value->value == value)
+                    gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), i);
+                }
+            }
+
+          renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (combobox));
+          g_object_set (G_OBJECT (renderers->data), "scale", 0.8, NULL);
+          g_list_free (renderers);
+
+          editable = GTK_CELL_EDITABLE (combobox);
+        }
+      else if (G_VALUE_HOLDS_STRING (&gvalue))
+        {
+          GtkWidget *entry;
+
+          entry = gtk_entry_new ();
+          gtk_widget_show (entry);
+          gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (&gvalue));
+
+          editable = GTK_CELL_EDITABLE (entry);
+        }
+      else if (G_VALUE_HOLDS_INT (&gvalue)    ||
+               G_VALUE_HOLDS_UINT (&gvalue)   ||
+               G_VALUE_HOLDS_INT64 (&gvalue)  ||
+               G_VALUE_HOLDS_UINT64 (&gvalue) ||
+               G_VALUE_HOLDS_LONG (&gvalue)   ||
+               G_VALUE_HOLDS_ULONG (&gvalue)  ||
+               G_VALUE_HOLDS_DOUBLE (&gvalue))
+        {
+          gdouble min, max, value;
+          GtkWidget *spinbutton;
+          guint digits = 0;
+
+          if (G_VALUE_HOLDS_INT (&gvalue))
+            {
+              GParamSpecInt *paramspec = G_PARAM_SPEC_INT (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_int (&gvalue);
+            }
+          else if (G_VALUE_HOLDS_UINT (&gvalue))
+            {
+              GParamSpecUInt *paramspec = G_PARAM_SPEC_UINT (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_uint (&gvalue);
+            }
+          else if (G_VALUE_HOLDS_INT64 (&gvalue))
+            {
+              GParamSpecInt64 *paramspec = G_PARAM_SPEC_INT64 (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_int64 (&gvalue);
+            }
+          else if (G_VALUE_HOLDS_UINT64 (&gvalue))
+            {
+              GParamSpecUInt64 *paramspec = G_PARAM_SPEC_UINT64 (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_uint64 (&gvalue);
+            }
+          else if (G_VALUE_HOLDS_LONG (&gvalue))
+            {
+              GParamSpecLong *paramspec = G_PARAM_SPEC_LONG (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_long (&gvalue);
+            }
+          else if (G_VALUE_HOLDS_ULONG (&gvalue))
+            {
+              GParamSpecULong *paramspec = G_PARAM_SPEC_ULONG (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_ulong (&gvalue);
+            }
+          else if (G_VALUE_HOLDS_DOUBLE (&gvalue))
+            {
+              GParamSpecDouble *paramspec = G_PARAM_SPEC_DOUBLE (prop);
+              min = paramspec->minimum;
+              max = paramspec->maximum;
+              value = g_value_get_double (&gvalue);
+              digits = 2;
+            }
+          else
+            {
+              /* Shouldn't really be able to happen. */
+              return NULL;
+            }
+
+          spinbutton = gtk_spin_button_new_with_range (min, max, 1);
+          gtk_widget_show (spinbutton);
+          gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton), value);
+          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
+
+          editable = GTK_CELL_EDITABLE(spinbutton);
+        }
+    }
+
+  g_value_unset (&gvalue);
+
+  if (!editable)
+    return NULL;
+
+  font_desc = pango_font_description_new ();
+  pango_font_description_set_size (font_desc, 8 * PANGO_SCALE);
+  gtk_widget_override_font (GTK_WIDGET (editable), font_desc);
+  pango_font_description_free (font_desc);
+
+  g_signal_connect (editable, "editing-done", G_CALLBACK (stop_editing), renderer);
+
+  return editable;
+}
+
+static void
+gtk_inspector_property_cell_renderer_class_init (GtkInspectorPropertyCellRendererClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
+
+  object_class->get_property = get_property;
+  object_class->set_property = set_property;
+
+  cell_class->start_editing = start_editing;
+
+  g_object_class_install_property (object_class, PROP_OBJECT,
+      g_param_spec_object ("object", "Object", "The object owning the property",
+                           G_TYPE_OBJECT, G_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class, PROP_NAME,
+      g_param_spec_string ("name", "Name", "The property name",
+                           NULL, G_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class, PROP_IS_CHILD_PROPERTY,
+      g_param_spec_boolean ("is-child-property", "Child property", "Child property",
+                            FALSE, G_PARAM_READWRITE));
+}
+
+GtkCellRenderer *
+gtk_inspector_property_cell_renderer_new (void)
+{
+  return g_object_new (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, NULL);
+}
+
+
+// vim: set et ts=2:
diff --git a/modules/inspector/property-cell-renderer.h b/modules/inspector/property-cell-renderer.h
new file mode 100644 (file)
index 0000000..c8afeee
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
+#define _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
+
+
+#include <gtk/gtk.h>
+
+
+#define GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER            (gtk_inspector_property_cell_renderer_get_type())
+#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRenderer))
+#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
+#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
+#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
+#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
+
+typedef struct _GtkInspectorPropertyCellRendererPrivate GtkInspectorPropertyCellRendererPrivate;
+
+typedef struct
+{
+  GtkCellRendererText parent;
+  GtkInspectorPropertyCellRendererPrivate *priv;
+} GtkInspectorPropertyCellRenderer;
+
+typedef struct
+{
+  GtkCellRendererTextClass parent;
+} GtkInspectorPropertyCellRendererClass;
+
+
+G_BEGIN_DECLS
+
+
+GType            gtk_inspector_property_cell_renderer_get_type (void);
+GtkCellRenderer *gtk_inspector_property_cell_renderer_new      (void);
+
+
+G_END_DECLS
+
+
+#endif // _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/python-hooks.c b/modules/inspector/python-hooks.c
new file mode 100644 (file)
index 0000000..74d74fa
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include <dlfcn.h>
+#include <signal.h>
+
+#ifdef ENABLE_PYTHON
+# include <Python.h>
+# include <pygobject.h>
+#endif
+
+#include "python-hooks.h"
+
+static gboolean python_enabled = FALSE;
+
+#ifdef ENABLE_PYTHON
+static GString *captured_stdout = NULL;
+static GString *captured_stderr = NULL;
+
+
+static PyObject *
+capture_stdout(PyObject *self, PyObject *args)
+{
+    char *str = NULL;
+
+    if (!PyArg_ParseTuple(args, "s", &str))
+        return NULL;
+
+    g_string_append(captured_stdout, str);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject *
+capture_stderr(PyObject *self, PyObject *args)
+{
+    char *str = NULL;
+
+    if (!PyArg_ParseTuple(args, "s", &str))
+        return NULL;
+
+    g_string_append(captured_stderr, str);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject *
+wrap_gobj(PyObject *self, PyObject *args)
+{
+    void *addr;
+    GObject *obj;
+
+    if (!PyArg_ParseTuple(args, "l", &addr))
+        return NULL;
+
+    if (!G_IS_OBJECT(addr))
+        return NULL; // XXX
+
+    obj = G_OBJECT(addr);
+
+    if (!obj)
+        return NULL; // XXX
+
+    return pygobject_new(obj);
+}
+
+static PyMethodDef gtk_inspector_python_methods[] = {
+    {"capture_stdout", capture_stdout, METH_VARARGS, "Captures stdout"},
+    {"capture_stderr", capture_stderr, METH_VARARGS, "Captures stderr"},
+    {"gobj", wrap_gobj, METH_VARARGS, "Wraps a C GObject"},
+    {NULL, NULL, 0, NULL}
+};
+
+
+static gboolean
+is_blacklisted(void)
+{
+    const char *prgname = g_get_prgname();
+
+    return (!strcmp(prgname, "gimp"));
+}
+#endif // ENABLE_PYTHON
+
+void
+gtk_inspector_python_init(void)
+{
+#ifdef ENABLE_PYTHON
+    int res;
+    struct sigaction old_sigint;
+
+    if (is_blacklisted())
+        return;
+
+    /* This prevents errors such as "undefined symbol: PyExc_ImportError" */
+    if (!dlopen(PYTHON_SHARED_LIB, RTLD_NOW | RTLD_GLOBAL))
+    {
+        g_error("%s\n", dlerror());
+        return;
+    }
+
+    captured_stdout = g_string_new("");
+    captured_stderr = g_string_new("");
+
+    /* Back up and later restore SIGINT so Python doesn't steal it from us. */
+    res = sigaction(SIGINT, NULL, &old_sigint);
+
+    if (!Py_IsInitialized())
+        Py_Initialize();
+
+    res = sigaction(SIGINT, &old_sigint, NULL);
+
+    Py_InitModule("gtk_inspector", gtk_inspector_python_methods);
+    PyRun_SimpleString(
+        "import gtk_inspector\n"
+        "import sys\n"
+        "\n"
+        "class StdoutCatcher:\n"
+        "    def write(self, str):\n"
+        "        gtk_inspector.capture_stdout(str)\n"
+        "\n"
+        "class StderrCatcher:\n"
+        "    def write(self, str):\n"
+        "        gtk_inspector.capture_stderr(str)\n"
+        "\n"
+    );
+
+    if (!pygobject_init(-1, -1, -1))
+    {
+        fprintf(stderr, "Error initializing pygobject support.\n");
+        PyErr_Print();
+        return;
+    }
+
+    char *argv[] = { "", NULL };
+    PySys_SetArgv(0, argv);
+
+    if (!PyImport_ImportModule("gi._gobject"))
+      {
+        PyErr_SetString(PyExc_ImportError, "could not import gi.gobject");
+        return;
+      }
+    if (!PyImport_ImportModule("gi.repository"))
+      {
+        PyErr_SetString(PyExc_ImportError, "could not import gi.repository");
+        return;
+      }
+    if (!PyImport_ImportModule("gi.repository.Gtk"))
+      {
+        PyErr_SetString(PyExc_ImportError, "could not import gtk");
+        return;
+      }
+
+    python_enabled = TRUE;
+#endif // ENABLE_PYTHON
+}
+
+void
+gtk_inspector_python_run(const char *command,
+                    GtkInspectorPythonLogger stdout_logger,
+                    GtkInspectorPythonLogger stderr_logger,
+                    gpointer user_data)
+{
+#ifdef ENABLE_PYTHON
+    PyGILState_STATE gstate;
+    PyObject *module;
+    PyObject *dict;
+    PyObject *obj;
+
+    gstate = PyGILState_Ensure();
+
+    module = PyImport_AddModule("__main__");
+    dict = PyModule_GetDict(module);
+
+    PyRun_SimpleString("old_stdout = sys.stdout\n"
+                       "old_stderr = sys.stderr\n"
+                       "sys.stdout = StdoutCatcher()\n"
+                       "sys.stderr = StderrCatcher()\n");
+
+    obj = PyRun_String(command, Py_single_input, dict, dict);
+
+    PyRun_SimpleString("sys.stdout = old_stdout\n"
+                       "sys.stderr = old_stderr\n");
+
+    if (stdout_logger != NULL)
+        stdout_logger(captured_stdout->str, user_data);
+
+    if (stderr_logger != NULL)
+        stderr_logger(captured_stderr->str, user_data);
+
+    // Print any returned object
+    if (obj != NULL && obj != Py_None) {
+       PyObject *repr = PyObject_Repr(obj);
+       if (repr != NULL) {
+           char *string = PyString_AsString(repr);
+
+           stdout_logger(string, user_data);
+           stdout_logger("\n", user_data);
+        }
+
+        Py_XDECREF(repr);
+    }
+    Py_XDECREF(obj);
+
+    PyGILState_Release(gstate);
+    g_string_erase(captured_stdout, 0, -1);
+    g_string_erase(captured_stderr, 0, -1);
+#endif // ENABLE_PYTHON
+}
+
+gboolean
+gtk_inspector_python_is_enabled(void)
+{
+    return python_enabled;
+}
+
+// vim: set et sw=4 ts=4:
diff --git a/modules/inspector/python-hooks.h b/modules/inspector/python-hooks.h
new file mode 100644 (file)
index 0000000..331fe74
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_PYTHON_MODULE_H_
+#define _GTK_INSPECTOR_PYTHON_MODULE_H_
+
+#include <glib.h>
+
+
+typedef void (*GtkInspectorPythonLogger)(const char *text, gpointer user_data);
+
+void gtk_inspector_python_init(void);
+void gtk_inspector_python_run(const char *command,
+                         GtkInspectorPythonLogger stdout_logger,
+                         GtkInspectorPythonLogger stderr_logger,
+                         gpointer user_data);
+gboolean gtk_inspector_python_is_enabled(void);
+
+#endif // _GTK_INSPECTOR_PYTHON_MODULE_H_
diff --git a/modules/inspector/python-shell.c b/modules/inspector/python-shell.c
new file mode 100644 (file)
index 0000000..5d13f78
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include <gdk/gdkkeysyms.h>
+#include <string.h>
+
+#include "python-hooks.h"
+#include "python-shell.h"
+
+#define MAX_HISTORY_LENGTH 20
+
+struct _GtkInspectorPythonShellPrivate
+{
+    GtkWidget *textview;
+
+    GtkTextMark *scroll_mark;
+    GtkTextMark *line_start_mark;
+
+    GQueue *history;
+    GList *cur_history_item;
+
+    GString *pending_command;
+    gboolean in_block;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPythonShell, gtk_inspector_python_shell, GTK_TYPE_BOX);
+
+/* Widget functions */
+static void gtk_inspector_python_shell_finalize (GObject *obj);
+
+/* Python integration */
+static void gtk_inspector_python_shell_write_prompt(GtkWidget *python_shell);
+static char *gtk_inspector_python_shell_get_input(GtkWidget *python_shell);
+
+/* Callbacks */
+static gboolean gtk_inspector_python_shell_key_press_cb(GtkWidget *textview,
+                                                   GdkEventKey *event,
+                                                   GtkWidget *python_shell);
+static void
+gtk_inspector_python_shell_class_init(GtkInspectorPythonShellClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+    object_class->finalize = gtk_inspector_python_shell_finalize;
+}
+
+static void
+gtk_inspector_python_shell_init (GtkInspectorPythonShell *python_shell)
+{
+    GtkWidget *swin;
+    GtkTextBuffer *buffer;
+    GtkTextIter iter;
+    PangoFontDescription *font_desc;
+
+    python_shell->priv = gtk_inspector_python_shell_get_instance_private (python_shell);
+
+    python_shell->priv->history = g_queue_new();
+
+    gtk_box_set_spacing(GTK_BOX(python_shell), 6);
+
+    swin = gtk_scrolled_window_new(NULL, NULL);
+    gtk_widget_show(swin);
+    gtk_box_pack_start(GTK_BOX(python_shell), swin, TRUE, TRUE, 0);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
+                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin),
+                                        GTK_SHADOW_IN);
+
+    python_shell->priv->textview = gtk_text_view_new();
+    gtk_widget_show(python_shell->priv->textview);
+    gtk_container_add(GTK_CONTAINER(swin), python_shell->priv->textview);
+    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(python_shell->priv->textview), TRUE);
+    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
+    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
+    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
+
+    g_signal_connect(python_shell->priv->textview, "key_press_event",
+                     G_CALLBACK(gtk_inspector_python_shell_key_press_cb),
+                     python_shell);
+
+    /* Make the textview monospaced */
+    font_desc = pango_font_description_from_string("monospace");
+    pango_font_description_set_size(font_desc, 8 * PANGO_SCALE);
+    gtk_widget_override_font(python_shell->priv->textview, font_desc);
+    pango_font_description_free(font_desc);
+
+    /* Create the end-of-buffer mark */
+    buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(python_shell->priv->textview));
+    gtk_text_buffer_get_end_iter(buffer, &iter);
+    python_shell->priv->scroll_mark = gtk_text_buffer_create_mark(buffer, "scroll_mark",
+                                                    &iter, FALSE);
+
+    /* Create the beginning-of-line mark */
+    python_shell->priv->line_start_mark = gtk_text_buffer_create_mark(buffer,
+                                                        "line_start_mark",
+                                                        &iter, TRUE);
+
+    /* Register some tags */
+    gtk_text_buffer_create_tag(buffer, "stdout", NULL);
+    gtk_text_buffer_create_tag(buffer, "stderr",
+                               "foreground", "red",
+                               "paragraph-background", "#FFFFE0",
+                               NULL);
+    gtk_text_buffer_create_tag(buffer, "prompt",
+                               "foreground", "blue",
+                               NULL);
+
+    gtk_inspector_python_shell_write_prompt(GTK_WIDGET(python_shell));
+}
+
+static void
+gtk_inspector_python_shell_finalize(GObject *python_shell)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+
+    g_queue_free(priv->history);
+}
+
+static void
+gtk_inspector_python_shell_log_stdout(const char *text, gpointer python_shell)
+{
+    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
+                                      text, "stdout");
+}
+
+static void
+gtk_inspector_python_shell_log_stderr(const char *text, gpointer python_shell)
+{
+    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
+                                      text, "stderr");
+}
+
+static void
+gtk_inspector_python_shell_write_prompt(GtkWidget *python_shell)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+    GtkTextBuffer *buffer =
+        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
+    GtkTextIter iter;
+    const char *prompt = (priv->pending_command == NULL ? ">>> " : "... ");
+
+    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
+                                      prompt, "prompt");
+
+    gtk_text_buffer_get_end_iter(buffer, &iter);
+    gtk_text_buffer_move_mark(buffer, priv->line_start_mark, &iter);
+}
+
+static void
+gtk_inspector_python_shell_process_line(GtkWidget *python_shell)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+    char *command = gtk_inspector_python_shell_get_input(python_shell);
+    char last_char;
+
+    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
+                                      "\n", NULL);
+
+    if (*command != '\0')
+    {
+        /* Save this command in the history. */
+        g_queue_push_head(priv->history, command);
+        priv->cur_history_item = NULL;
+
+        if (g_queue_get_length(priv->history) > MAX_HISTORY_LENGTH)
+            g_free(g_queue_pop_tail(priv->history));
+    }
+
+    last_char = command[MAX(0, strlen(command) - 1)];
+
+    if (last_char == ':' || last_char == '\\' ||
+        (priv->in_block && g_ascii_isspace(command[0])))
+    {
+        printf("in block.. %c, %d, %d\n",
+               last_char, priv->in_block,
+               g_ascii_isspace(command[0]));
+        /* This is a multi-line expression */
+        if (priv->pending_command == NULL)
+            priv->pending_command = g_string_new(command);
+        else
+            g_string_append(priv->pending_command, command);
+
+        g_string_append_c(priv->pending_command, '\n');
+
+        if (last_char == ':')
+            priv->in_block = TRUE;
+    }
+    else
+    {
+        if (priv->pending_command != NULL)
+        {
+            g_string_append(priv->pending_command, command);
+            g_string_append_c(priv->pending_command, '\n');
+
+            /* We're not actually leaking this. It's in the history. */
+            command = g_string_free(priv->pending_command, FALSE);
+        }
+
+        gtk_inspector_python_run(command,
+                            gtk_inspector_python_shell_log_stdout,
+                            gtk_inspector_python_shell_log_stderr,
+                            python_shell);
+
+        if (priv->pending_command != NULL)
+        {
+            /* Now do the cleanup. */
+            g_free(command);
+            priv->pending_command = NULL;
+            priv->in_block = FALSE;
+        }
+    }
+
+    gtk_inspector_python_shell_write_prompt(python_shell);
+}
+
+static void
+gtk_inspector_python_shell_replace_input(GtkWidget *python_shell,
+                                    const char *text)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+    GtkTextBuffer *buffer =
+        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
+    GtkTextIter start_iter;
+    GtkTextIter end_iter;
+
+    gtk_text_buffer_get_iter_at_mark(buffer, &start_iter,
+                                     priv->line_start_mark);
+    gtk_text_buffer_get_end_iter(buffer, &end_iter);
+
+    gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
+    gtk_text_buffer_insert(buffer, &end_iter, text, -1);
+}
+
+static char *
+gtk_inspector_python_shell_get_input(GtkWidget *python_shell)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+    GtkTextBuffer *buffer =
+        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
+    GtkTextIter start_iter;
+    GtkTextIter end_iter;
+
+    gtk_text_buffer_get_iter_at_mark(buffer, &start_iter,
+                                     priv->line_start_mark);
+    gtk_text_buffer_get_end_iter(buffer, &end_iter);
+
+    return gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, FALSE);
+}
+
+static const char *
+gtk_inspector_python_shell_get_history_back(GtkWidget *python_shell)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+
+    if (priv->cur_history_item == NULL)
+    {
+        priv->cur_history_item = g_queue_peek_head_link(priv->history);
+
+        if (priv->cur_history_item == NULL)
+            return "";
+    }
+    else if (priv->cur_history_item->next != NULL)
+        priv->cur_history_item = priv->cur_history_item->next;
+
+    return (const char *)priv->cur_history_item->data;
+}
+
+static const char *
+gtk_inspector_python_shell_get_history_forward(GtkWidget *python_shell)
+{
+    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+
+    if (priv->cur_history_item == NULL || priv->cur_history_item->prev == NULL)
+    {
+        priv->cur_history_item = NULL;
+        return "";
+    }
+
+    priv->cur_history_item = priv->cur_history_item->prev;
+
+    return (const char *)priv->cur_history_item->data;
+}
+
+static gboolean
+gtk_inspector_python_shell_key_press_cb(GtkWidget *textview,
+                                   GdkEventKey *event,
+                                   GtkWidget *python_shell)
+{
+    if (event->keyval == GDK_KEY_Return)
+    {
+        gtk_inspector_python_shell_process_line(python_shell);
+        return TRUE;
+    }
+    else if (event->keyval == GDK_KEY_Up)
+    {
+        gtk_inspector_python_shell_replace_input(python_shell,
+            gtk_inspector_python_shell_get_history_back(python_shell));
+        return TRUE;
+    }
+    else if (event->keyval == GDK_KEY_Down)
+    {
+        gtk_inspector_python_shell_replace_input(python_shell,
+            gtk_inspector_python_shell_get_history_forward(python_shell));
+        return TRUE;
+    }
+    else if (event->string != NULL)
+    {
+        GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
+        GtkTextBuffer *buffer =
+            gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
+        GtkTextMark *insert_mark = gtk_text_buffer_get_insert(buffer);
+        GtkTextMark *selection_mark =
+            gtk_text_buffer_get_selection_bound(buffer);
+        GtkTextIter insert_iter;
+        GtkTextIter selection_iter;
+        GtkTextIter start_iter;
+        gint cmp_start_insert;
+        gint cmp_start_select;
+        gint cmp_insert_select;
+
+        gtk_text_buffer_get_iter_at_mark(buffer, &start_iter,
+                                         priv->line_start_mark);
+        gtk_text_buffer_get_iter_at_mark(buffer, &insert_iter, insert_mark);
+        gtk_text_buffer_get_iter_at_mark(buffer, &selection_iter,
+                                         selection_mark);
+
+        cmp_start_insert = gtk_text_iter_compare(&start_iter, &insert_iter);
+        cmp_start_select = gtk_text_iter_compare(&start_iter, &selection_iter);
+        cmp_insert_select = gtk_text_iter_compare(&insert_iter,
+                                                  &selection_iter);
+
+        if (cmp_start_insert == 0 && cmp_start_select == 0 &&
+            (event->keyval == GDK_KEY_BackSpace ||
+             event->keyval == GDK_KEY_Left))
+        {
+            return TRUE;
+        }
+        if (cmp_start_insert <= 0 && cmp_start_select <= 0)
+        {
+            return FALSE;
+        }
+        else if (cmp_start_insert > 0 && cmp_start_select > 0)
+        {
+            gtk_text_buffer_place_cursor(buffer, &start_iter);
+        }
+        else if (cmp_insert_select < 0)
+        {
+            gtk_text_buffer_move_mark(buffer, insert_mark, &start_iter);
+        }
+        else if (cmp_insert_select > 0)
+        {
+            gtk_text_buffer_move_mark(buffer, selection_mark, &start_iter);
+        }
+    }
+
+    return FALSE;
+}
+
+GtkWidget *
+gtk_inspector_python_shell_new(void)
+{
+    return g_object_new(GTK_TYPE_INSPECTOR_PYTHON_SHELL, NULL);
+}
+
+void
+gtk_inspector_python_shell_append_text(GtkInspectorPythonShell *python_shell,
+                                  const char *str,
+                                  const char *tag)
+{
+    GtkInspectorPythonShellPrivate *priv = python_shell->priv;
+
+    GtkTextIter end;
+    GtkTextBuffer *buffer =
+        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
+    GtkTextMark *mark = gtk_text_buffer_get_insert(buffer);
+
+    gtk_text_buffer_get_end_iter(buffer, &end);
+    gtk_text_buffer_move_mark(buffer, mark, &end);
+    gtk_text_buffer_insert_with_tags_by_name(buffer, &end, str, -1, tag, NULL);
+    gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(priv->textview), mark,
+                                 0, TRUE, 0, 1);
+}
+
+void
+gtk_inspector_python_shell_focus(GtkInspectorPythonShell *python_shell)
+{
+   gtk_widget_grab_focus (python_shell->priv->textview);
+}
+
+// vim: set et ts=4:
diff --git a/modules/inspector/python-shell.h b/modules/inspector/python-shell.h
new file mode 100644 (file)
index 0000000..9e002a9
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_PYTHON_SHELL_H_
+#define _GTK_INSPECTOR_PYTHON_SHELL_H_
+
+typedef struct _GtkInspectorPythonShell         GtkInspectorPythonShell;
+typedef struct _GtkInspectorPythonShellClass    GtkInspectorPythonShellClass;
+typedef struct _GtkInspectorPythonShellPrivate  GtkInspectorPythonShellPrivate;
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_PYTHON_SHELL (gtk_inspector_python_shell_get_type())
+#define GTK_INSPECTOR_PYTHON_SHELL(obj) \
+               (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShell))
+#define GTK_INSPECTOR_PYTHON_SHELL_CLASS(klass) \
+               (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShellClass))
+#define GTK_INSPECTOR_IS_PYTHON_SHELL(obj) \
+               (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL))
+#define GTK_INSPECTOR_IS_PYTHON_SHELL_CLASS(klass) \
+               (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PYTHON_SHELL))
+#define GTK_INSPECTOR_PYTHON_SHELL_GET_CLASS(obj) \
+               (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShellClass))
+
+
+struct _GtkInspectorPythonShell
+{
+  GtkBox parent_object;
+  GtkInspectorPythonShellPrivate *priv;
+};
+
+struct _GtkInspectorPythonShellClass
+{
+ GtkBoxClass parent_class;
+};
+
+G_BEGIN_DECLS
+
+GType gtk_inspector_python_shell_get_type(void);
+
+GtkWidget *gtk_inspector_python_shell_new(void);
+void gtk_inspector_python_shell_append_text(GtkInspectorPythonShell *python_shell,
+                                       const char *str,
+                                       const char *tag);
+void gtk_inspector_python_shell_focus(GtkInspectorPythonShell *python_shell);
+
+G_END_DECLS
+
+#endif // _GTK_INSPECTOR_PYTHON_SHELL_H_
diff --git a/modules/inspector/themes.c b/modules/inspector/themes.c
new file mode 100644 (file)
index 0000000..f2cb438
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "themes.h"
+
+struct _GtkInspectorThemesPrivate
+{
+  GtkWidget *dark_switch;
+  GtkWidget *theme_combo;
+  GtkWidget *icon_combo;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorThemes, gtk_inspector_themes, GTK_TYPE_LIST_BOX)
+
+static void
+init_dark (GtkInspectorThemes *pt)
+{
+  g_object_bind_property (pt->priv->dark_switch, "active",
+                          gtk_settings_get_default (), "gtk-application-prefer-dark-theme",
+                          G_BINDING_BIDIRECTIONAL);
+}
+
+static void
+fill_gtk (const gchar *path,
+          GHashTable  *t)
+{
+  const gchar *dir_entry;
+  GDir *dir = g_dir_open (path, 0, NULL);
+
+  if (!dir)
+    return;
+
+  while ((dir_entry = g_dir_read_name (dir)))
+    {
+      gchar *filename = g_build_filename (path, dir_entry, "gtk-3.0", "gtk.css", NULL);
+
+      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
+          !g_hash_table_contains (t, dir_entry))
+        g_hash_table_add (t, g_strdup (dir_entry));
+
+      g_free (filename);
+    }
+}
+
+static void
+init_theme (GtkInspectorThemes *pt)
+{
+  GHashTable *t;
+  GHashTableIter iter;
+  gchar *theme, *current_theme, *path;
+  gint i, pos;
+  GSettings *settings;
+
+  t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  g_hash_table_add (t, g_strdup ("Raleigh"));
+
+  fill_gtk (GTK_DATADIR "/themes", t);
+  path = g_build_filename (g_get_user_data_dir (), "themes", NULL);
+  fill_gtk (path, t);
+  g_free (path);
+
+  settings = g_settings_new ("org.gnome.desktop.interface");
+  current_theme = g_settings_get_string (settings, "gtk-theme");
+  g_object_unref (settings);
+
+  g_hash_table_iter_init (&iter, t);
+  pos = i = 0;
+  while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
+    {
+      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pt->priv->theme_combo), theme);
+      if (g_strcmp0 (theme, current_theme) == 0)
+        pos = i;
+      i++;
+    }
+  g_hash_table_destroy (t);
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (pt->priv->theme_combo), pos);
+}
+
+static void
+fill_icons (const gchar *path,
+            GHashTable  *t)
+{
+  const gchar *dir_entry;
+  GDir *dir = g_dir_open (path, 0, NULL);
+
+  if (!dir)
+    return;
+
+  while ((dir_entry = g_dir_read_name (dir)))
+    {
+      gchar *filename = g_build_filename (path, dir_entry, "index.theme", NULL);
+
+      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
+          g_strcmp0 (dir_entry, "hicolor") != 0 &&
+          !g_hash_table_contains (t, dir_entry))
+        g_hash_table_add (t, g_strdup (dir_entry));
+
+      g_free (filename);
+    }
+}
+
+static void
+init_icons (GtkInspectorThemes *pt)
+{
+  GHashTable *t;
+  GHashTableIter iter;
+  gchar *theme, *current_theme, *path;
+  gint i, pos;
+  GSettings *settings;
+
+  t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  fill_icons (GTK_DATADIR "/icons", t);
+  path = g_build_filename (g_get_user_data_dir (), "icons", NULL);
+  fill_icons (path, t);
+  g_free (path);
+
+  settings = g_settings_new ("org.gnome.desktop.interface");
+  current_theme = g_settings_get_string (settings, "icon-theme");
+  g_object_unref (settings);
+
+  g_hash_table_iter_init (&iter, t);
+  pos = i = 0;
+  while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
+    {
+      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pt->priv->icon_combo), theme);
+      if (g_strcmp0 (theme, current_theme) == 0)
+        pos = i;
+      i++;
+    }
+  g_hash_table_destroy (t);
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (pt->priv->icon_combo), pos);
+}
+
+static void
+theme_changed (GtkComboBox        *c,
+               GtkInspectorThemes *pt)
+{
+  gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
+  g_object_set (gtk_settings_get_default (), "gtk-theme-name", theme, NULL);
+  g_free (theme);
+}
+
+static void
+icons_changed (GtkComboBox        *c,
+               GtkInspectorThemes *pt)
+{
+  gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
+  g_object_set (gtk_settings_get_default (), "gtk-icon-theme-name", theme, NULL);
+  g_free (theme);
+}
+
+static void
+gtk_inspector_themes_init (GtkInspectorThemes *pt)
+{
+  pt->priv = gtk_inspector_themes_get_instance_private (pt);
+  gtk_widget_init_template (GTK_WIDGET (pt));
+
+  init_dark (pt);
+  init_theme (pt);
+  init_icons (pt);
+}
+
+static void
+gtk_inspector_themes_class_init (GtkInspectorThemesClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/themes.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, dark_switch);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, theme_combo);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, icon_combo);
+
+  gtk_widget_class_bind_template_callback (widget_class, theme_changed);
+  gtk_widget_class_bind_template_callback (widget_class, icons_changed);
+}
+
+GtkWidget *
+gtk_inspector_themes_new (void)
+{
+  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_THEMES, NULL));
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/themes.h b/modules/inspector/themes.h
new file mode 100644 (file)
index 0000000..f70fb79
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef _GTK_INSPECTOR_THEMES_H_
+#define _GTK_INSPECTOR_THEMES_H_
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_THEMES            (gtk_inspector_themes_get_type())
+#define GTK_INSPECTOR_THEMES(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemes))
+#define GTK_INSPECTOR_THEMES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
+#define GTK_INSPECTOR_IS_THEMES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_THEMES))
+#define GTK_INSPECTOR_IS_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_THEMES))
+#define GTK_INSPECTOR_THEMES_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
+
+
+typedef struct _GtkInspectorThemesPrivate GtkInspectorThemesPrivate;
+
+typedef struct _GtkInspectorThemes
+{
+  GtkListBox parent;
+  GtkInspectorThemesPrivate *priv;
+} GtkInspectorThemes;
+
+typedef struct _GtkInspectorThemesClass
+{
+  GtkListBoxClass parent;
+} GtkInspectorThemesClass;
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_themes_get_type (void);
+GtkWidget *gtk_inspector_themes_new      (void);
+
+G_END_DECLS
+
+#endif // _GTK_INSPECTOR_THEMES_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/themes.ui b/modules/inspector/themes.ui
new file mode 100644 (file)
index 0000000..1e94264
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkInspectorThemes" parent="GtkListBox">
+    <property name="selection-mode">none</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="orientation">horizontal</property>
+        <property name="margin">10</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label">Use dark variant</property>
+            <property name="hexpand">True</property>
+            <property name="xalign">0.0</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSwitch" id="dark_switch">
+            <property name="visible">True</property>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="orientation">horizontal</property>
+        <property name="margin">10</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label">GTK+ Theme</property>
+            <property name="hexpand">True</property>
+            <property name="xalign">0.0</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkComboBoxText" id="theme_combo">
+            <property name="visible">True</property>
+            <signal name="changed" handler="theme_changed"/>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="orientation">horizontal</property>
+        <property name="margin">10</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label">Icon Theme</property>
+            <property name="hexpand">True</property>
+            <property name="xalign">0.0</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkComboBoxText" id="icon_combo">
+            <property name="visible">True</property>
+            <signal name="changed" handler="icons_changed"/>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/widget-tree.c b/modules/inspector/widget-tree.c
new file mode 100644 (file)
index 0000000..3dc585a
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "prop-list.h"
+#include "widget-tree.h"
+#include <string.h>
+
+enum
+{
+  OBJECT,
+  OBJECT_TYPE,
+  OBJECT_NAME,
+  WIDGET_REALIZED,
+  WIDGET_VISIBLE,
+  WIDGET_MAPPED,
+  OBJECT_ADDRESS,
+  SENSITIVE
+};
+
+
+enum
+{
+  WIDGET_CHANGED,
+  LAST_SIGNAL
+};
+
+
+struct _GtkInspectorWidgetTreePrivate
+{
+  GtkTreeStore *model;
+  GHashTable *iters;
+};
+
+static guint widget_tree_signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorWidgetTree, gtk_inspector_widget_tree, GTK_TYPE_TREE_VIEW)
+
+static void
+on_widget_selected (GtkTreeSelection       *selection,
+                    GtkInspectorWidgetTree *wt)
+{
+  g_signal_emit (wt, widget_tree_signals[WIDGET_CHANGED], 0);
+}
+
+
+static void
+gtk_inspector_widget_tree_init (GtkInspectorWidgetTree *wt)
+{
+  wt->priv = gtk_inspector_widget_tree_get_instance_private (wt);
+  wt->priv->iters = g_hash_table_new_full (g_direct_hash,
+                                           g_direct_equal,
+                                           NULL,
+                                           (GDestroyNotify) gtk_tree_iter_free);
+  gtk_widget_init_template (GTK_WIDGET (wt));
+
+  gtk_inspector_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
+}
+
+static void
+gtk_inspector_widget_tree_class_init (GtkInspectorWidgetTreeClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  klass->widget_changed = NULL;
+
+  widget_tree_signals[WIDGET_CHANGED] =
+      g_signal_new ("widget-changed",
+                    G_OBJECT_CLASS_TYPE(klass),
+                    G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
+                    G_STRUCT_OFFSET(GtkInspectorWidgetTreeClass, widget_changed),
+                    NULL, NULL,
+                    g_cclosure_marshal_VOID__VOID,
+                    G_TYPE_NONE, 0);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/widget-tree.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorWidgetTree, model);
+  gtk_widget_class_bind_template_callback (widget_class, on_widget_selected);
+}
+
+GtkWidget *
+gtk_inspector_widget_tree_new (void)
+{
+  return g_object_new (GTK_TYPE_INSPECTOR_WIDGET_TREE, NULL);
+}
+
+
+GObject *
+gtk_inspector_widget_tree_get_selected_object (GtkInspectorWidgetTree *wt)
+{
+  GtkTreeIter iter;
+  GtkTreeSelection *sel;
+  GtkTreeModel *model;
+
+  sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (wt));
+
+  if (gtk_tree_selection_get_selected (sel, &model, &iter))
+    {
+      GObject *object;
+      gtk_tree_model_get (model, &iter,
+                          OBJECT, &object,
+                          -1);
+      return object;
+    }
+
+  return NULL;
+}
+
+typedef struct
+{
+  GtkInspectorWidgetTree *wt;
+  GtkTreeIter *iter;
+} FindAllData;
+
+static void
+on_container_forall (GtkWidget *widget,
+                     gpointer   data)
+{
+  FindAllData *d = data;
+  gtk_inspector_widget_tree_append_object (d->wt, G_OBJECT (widget), d->iter);
+}
+
+void
+gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
+                                         GObject                *object,
+                                         GtkTreeIter            *parent_iter)
+{
+  GtkTreeIter iter;
+  const gchar *class_name = G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (object));
+  const gchar *name = NULL;
+  gchar *address;
+  gboolean realized;
+  gboolean mapped;
+  gboolean visible;
+  gboolean is_widget;
+
+  realized = mapped = visible = FALSE;
+
+  is_widget = GTK_IS_WIDGET (object);
+  if (is_widget)
+    {
+      GtkWidget *widget = GTK_WIDGET (object);
+      name = gtk_widget_get_name (GTK_WIDGET (object));
+      realized = gtk_widget_get_realized  (widget);
+      mapped = gtk_widget_get_mapped (widget);
+      visible = gtk_widget_get_visible (widget);
+    }
+
+  if (name == NULL || g_strcmp0 (name, class_name) == 0)
+    {
+      if (GTK_IS_LABEL (object))
+        name = gtk_label_get_text (GTK_LABEL (object));
+      else if (GTK_IS_BUTTON (object))
+        name = gtk_button_get_label (GTK_BUTTON (object));
+      else if (GTK_IS_WINDOW (object))
+        name = gtk_window_get_title (GTK_WINDOW (object));
+      else
+        name = "";
+    }
+
+  address = g_strdup_printf ("%p", object);
+
+  gtk_tree_store_append (wt->priv->model, &iter, parent_iter);
+  gtk_tree_store_set (wt->priv->model, &iter,
+                      OBJECT, object,
+                      OBJECT_TYPE, class_name,
+                      OBJECT_NAME, name,
+                      WIDGET_REALIZED, realized,
+                      WIDGET_MAPPED, mapped,
+                      WIDGET_VISIBLE, visible,
+                      OBJECT_ADDRESS, address,
+                      SENSITIVE, !is_widget || (realized && mapped && visible),
+                      -1);
+  g_hash_table_insert (wt->priv->iters, object, gtk_tree_iter_copy (&iter));
+
+  g_free(address);
+
+  if (GTK_IS_CONTAINER (object))
+    {
+      FindAllData data;
+
+      data.wt = wt;
+      data.iter = &iter;
+
+      gtk_container_forall (GTK_CONTAINER (object), on_container_forall, &data);
+    }
+}
+
+void
+gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt,
+                                GtkWidget              *window)
+{
+  gtk_tree_store_clear (wt->priv->model);
+  g_hash_table_remove_all (wt->priv->iters);
+  gtk_inspector_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
+  gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL);
+
+  gtk_tree_view_columns_autosize (GTK_TREE_VIEW (wt));
+}
+
+gboolean
+gtk_inspector_widget_tree_find_object (GtkInspectorWidgetTree *wt,
+                                       GObject                *object,
+                                       GtkTreeIter            *iter)
+{
+  GtkTreeIter *internal_iter = g_hash_table_lookup (wt->priv->iters, object);
+  if (internal_iter)
+    {
+      *iter = *internal_iter;
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+void
+gtk_inspector_widget_tree_select_object (GtkInspectorWidgetTree *wt,
+                                         GObject                *object)
+{
+  GtkTreeIter iter;
+
+  if (gtk_inspector_widget_tree_find_object (wt, object, &iter))
+    {
+      GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (wt->priv->model), &iter);
+      gtk_tree_view_expand_to_path (GTK_TREE_VIEW (wt), path);
+      gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (wt)), &iter);
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (wt), path, NULL, FALSE, 0, 0);
+    }
+}
+
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/widget-tree.h b/modules/inspector/widget-tree.h
new file mode 100644 (file)
index 0000000..d3616e2
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_WIDGET_TREE_H_
+#define _GTK_INSPECTOR_WIDGET_TREE_H_
+
+
+#include <gtk/gtk.h>
+
+
+#define GTK_TYPE_INSPECTOR_WIDGET_TREE            (gtk_inspector_widget_tree_get_type())
+#define GTK_INSPECTOR_WIDGET_TREE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTree))
+#define GTK_INSPECTOR_WIDGET_TREE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTreeClass))
+#define GTK_INSPECTOR_IS_WIDGET_TREE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE))
+#define GTK_INSPECTOR_IS_WIDGET_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_WIDGET_TREE))
+#define GTK_INSPECTOR_WIDGET_TREE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTreeClass))
+
+
+typedef struct _GtkInspectorWidgetTreePrivate GtkInspectorWidgetTreePrivate;
+
+typedef struct _GtkInspectorWidgetTree
+{
+  GtkTreeView parent;
+  GtkInspectorWidgetTreePrivate *priv;
+} GtkInspectorWidgetTree;
+
+typedef struct _GtkInspectorWidgetTreeClass
+{
+  GtkTreeViewClass parent;
+
+  void (*widget_changed) (GtkInspectorWidgetTree *tree);
+} GtkInspectorWidgetTreeClass;
+
+
+G_BEGIN_DECLS
+
+
+GType      gtk_inspector_widget_tree_get_type            (void);
+GtkWidget *gtk_inspector_widget_tree_new                 (void);
+
+GObject   *gtk_inspector_widget_tree_get_selected_object (GtkInspectorWidgetTree *wt);
+
+void       gtk_inspector_widget_tree_scan                (GtkInspectorWidgetTree *wt,
+                                                          GtkWidget              *window);
+void       gtk_inspector_widget_tree_select_object       (GtkInspectorWidgetTree *wt,
+                                                          GObject                *object);
+void       gtk_inspector_widget_tree_append_object       (GtkInspectorWidgetTree *wt,
+                                                          GObject                *object,
+                                                          GtkTreeIter            *parent_iter);
+gboolean   gtk_inspector_widget_tree_find_object         (GtkInspectorWidgetTree *wt,
+                                                          GObject                *object,
+                                                          GtkTreeIter            *iter);
+
+G_END_DECLS
+
+
+#endif // _GTK_INSPECTOR_WIDGETTREE_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/widget-tree.ui b/modules/inspector/widget-tree.ui
new file mode 100644 (file)
index 0000000..9a53d5f
--- /dev/null
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkTreeStore" id="model">
+    <columns>
+      <column type="gpointer"/>
+      <column type="gchararray"/>
+      <column type="gchararray"/>
+      <column type="gboolean"/>
+      <column type="gboolean"/>
+      <column type="gboolean"/>
+      <column type="gchararray"/>
+      <column type="gboolean"/>
+    </columns>
+  </object>
+  <template class="GtkInspectorWidgetTree" parent="GtkTreeView">
+    <property name="model">model</property>
+    <property name="enable-search">True</property>
+    <property name="search-column">2</property>
+    <child internal-child="selection">
+      <object class="GtkTreeSelection">
+        <signal name="changed" handler="on_widget_selected"/>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Widget</property>
+        <property name="resizable">True</property>
+        <child>
+          <object class="GtkCellRendererText">
+            <property name="scale">0.8</property>
+          </object>
+          <attributes>
+            <attribute name="text">1</attribute>
+            <attribute name="sensitive">7</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Name</property>
+        <property name="resizable">True</property>
+        <child>
+          <object class="GtkCellRendererText">
+            <property name="scale">0.8</property>
+          </object>
+          <attributes>
+            <attribute name="text">2</attribute>
+            <attribute name="sensitive">7</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Realized</property>
+        <child>
+          <object class="GtkCellRendererToggle">
+            <property name="activatable">True</property>
+            <property name="indicator-size">10</property>
+          </object>
+          <attributes>
+            <attribute name="active">3</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Mapped</property>
+        <child>
+          <object class="GtkCellRendererToggle">
+            <property name="activatable">True</property>
+            <property name="indicator-size">10</property>
+          </object>
+          <attributes>
+            <attribute name="active">4</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Visible</property>
+        <child>
+          <object class="GtkCellRendererToggle">
+            <property name="activatable">True</property>
+            <property name="indicator-size">10</property>
+          </object>
+          <attributes>
+            <attribute name="active">5</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkTreeViewColumn">
+        <property name="title">Address</property>
+        <property name="resizable">True</property>
+        <child>
+          <object class="GtkCellRendererText">
+            <property name="scale">0.8</property>
+            <property name="family">monospace</property>
+          </object>
+          <attributes>
+            <attribute name="text">6</attribute>
+            <attribute name="sensitive">7</attribute>
+          </attributes>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/inspector/window.c b/modules/inspector/window.c
new file mode 100644 (file)
index 0000000..4383e48
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include "window.h"
+#include "prop-list.h"
+#include "property-cell-renderer.h"
+#include "classes-list.h"
+#include "css-editor.h"
+#include "object-hierarchy.h"
+#include "widget-tree.h"
+#include "python-hooks.h"
+#include "python-shell.h"
+#include "button-path.h"
+#include "themes.h"
+
+G_DEFINE_TYPE (GtkInspectorWindow, gtk_inspector_window, GTK_TYPE_WINDOW)
+
+extern void on_inspect (GtkWidget *button, GtkInspectorWindow *iw);
+
+static void
+on_graphic_updates_toggled (GtkToggleButton    *button,
+                            GtkInspectorWindow *iw)
+{
+  gdk_window_set_debug_updates (gtk_toggle_button_get_active (button));
+}
+
+static gboolean
+on_widget_tree_button_press (GtkInspectorWidgetTree *wt,
+                             GdkEventButton         *event,
+                             GtkInspectorWindow     *iw)
+{
+  if (event->button == 3)
+    gtk_menu_popup (GTK_MENU (iw->widget_popup), NULL, NULL,
+                    NULL, NULL, event->button, event->time);
+
+  return FALSE;
+}
+
+static void
+on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
+                                  GtkInspectorWindow     *iw)
+{
+  GObject *selected = gtk_inspector_widget_tree_get_selected_object (wt);
+
+  if (selected != NULL)
+    {
+      if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
+        return;
+
+      gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
+      gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
+
+      if (GTK_IS_WIDGET (selected))
+        {
+          GtkWidget *widget = GTK_WIDGET (selected);
+
+          gtk_inspector_flash_widget (iw, widget);
+          gtk_inspector_button_path_set_widget (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), widget);
+          gtk_inspector_classes_list_set_widget (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), widget);
+          gtk_inspector_css_editor_set_widget (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), widget);
+        }
+      else
+        {
+          gtk_widget_set_sensitive (iw->classes_list, FALSE);
+          gtk_widget_set_sensitive (iw->widget_css_editor, FALSE);
+        }
+    }
+}
+
+static void
+on_send_widget_to_shell_activate (GtkWidget          *menuitem,
+                                  GtkInspectorWindow *iw)
+{
+  gchar *str;
+  GObject *object;
+
+  object = gtk_inspector_widget_tree_get_selected_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree));
+
+  if (!object)
+    return;
+
+  str = g_strdup_printf ("gtk_inspector.gobj(%p)", object);
+  gtk_inspector_python_shell_append_text (GTK_INSPECTOR_PYTHON_SHELL (iw->python_shell),
+                                     str,
+                                     NULL);
+
+  g_free (str);
+  gtk_inspector_python_shell_focus (GTK_INSPECTOR_PYTHON_SHELL (iw->python_shell));
+}
+
+static void
+gtk_inspector_window_init (GtkInspectorWindow *iw)
+{
+  gchar *title;
+
+  gtk_widget_init_template (GTK_WIDGET (iw));
+
+  gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));
+
+  title = g_strdup_printf ("GTK+ Inspector — %s", g_get_application_name ());
+  gtk_window_set_title (GTK_WINDOW (iw), title);
+  g_free (title);
+
+  if (gtk_inspector_python_is_enabled ())
+    {
+      gtk_widget_show (iw->python_shell);
+      g_signal_connect (G_OBJECT (iw->widget_tree), "button-press-event",
+                        G_CALLBACK (on_widget_tree_button_press), iw);
+    }
+}
+
+static void
+gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/window.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_tree);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, prop_list);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, child_prop_list);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, button_path);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, classes_list);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_css_editor);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_hierarchy);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, python_shell);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_popup);
+
+  gtk_widget_class_bind_template_callback (widget_class, on_inspect);
+  gtk_widget_class_bind_template_callback (widget_class, on_graphic_updates_toggled);
+  gtk_widget_class_bind_template_callback (widget_class, on_widget_tree_selection_changed);
+  gtk_widget_class_bind_template_callback (widget_class, on_send_widget_to_shell_activate);
+}
+
+GtkWidget *
+gtk_inspector_window_new (void)
+{
+  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_WINDOW, NULL));
+}
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/window.h b/modules/inspector/window.h
new file mode 100644 (file)
index 0000000..0c5e9cc
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2008-2009  Christian Hammond
+ * Copyright (c) 2008-2009  David Trowbridge
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef _GTK_INSPECTOR_WINDOW_H_
+#define _GTK_INSPECTOR_WINDOW_H_
+
+
+#include <gtk/gtk.h>
+
+#define GTK_TYPE_INSPECTOR_WINDOW            (gtk_inspector_window_get_type())
+#define GTK_INSPECTOR_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindow))
+#define GTK_INSPECTOR_WINDOW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindowClass))
+#define GTK_INSPECTOR_IS_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_WINDOW))
+#define GTK_INSPECTOR_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_WINDOW))
+#define GTK_INSPECTOR_WINDOW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindowClass))
+
+
+#define TREE_TEXT_SCALE 0.8
+#define TREE_CHECKBOX_SIZE (gint)(0.8 * 13)
+
+typedef struct
+{
+  GtkWindow parent;
+
+  GtkWidget *widget_tree;
+  GtkWidget *prop_list;
+  GtkWidget *child_prop_list;
+  GtkWidget *python_shell;
+  GtkWidget *button_path;
+  GtkWidget *classes_list;
+  GtkWidget *widget_css_editor;
+  GtkWidget *object_hierarchy;
+
+  GtkWidget *widget_popup;
+
+  GtkWidget *selected_widget;
+  GtkWidget *flash_widget;
+
+  gint flash_count;
+  gint flash_cnx;
+
+} GtkInspectorWindow;
+
+typedef struct
+{
+  GtkWindowClass parent;
+} GtkInspectorWindowClass;
+
+
+G_BEGIN_DECLS
+
+GType      gtk_inspector_window_get_type    (void);
+GtkWidget *gtk_inspector_window_new         (void);
+
+void       gtk_inspector_flash_widget       (GtkInspectorWindow *iw,
+                                             GtkWidget      *widget);
+
+GtkWidget *gtk_inspector_inspect_button_new (GtkInspectorWindow *iw);
+
+G_END_DECLS
+
+
+#endif // _GTK_INSPECTOR_WINDOW_H_
+
+// vim: set et sw=2 ts=2:
diff --git a/modules/inspector/window.ui b/modules/inspector/window.ui
new file mode 100644 (file)
index 0000000..a1d7a45
--- /dev/null
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkImage" id="update_image">
+    <property name="visible">True</property>
+    <property name="icon-name">view-refresh</property>
+    <property name="icon-size">4</property>
+  </object>
+  <object class="GtkImage" id="inspect_image">
+    <property name="visible">True</property>
+    <property name="icon-name">edit-find</property>
+    <property name="icon-size">4</property>
+  </object>
+  <object class="GtkMenu" id="widget_popup">
+    <property name="visible">True</property>
+    <child>
+      <object class="GtkMenuItem">
+        <property name="visible">True</property>
+        <property name="label">Send Widget to Shell</property>
+        <signal name="activate" handler="on_send_widget_to_shell_activate"/>
+      </object>
+    </child>
+  </object>
+  <template class="GtkInspectorWindow" parent="GtkWindow">
+    <property name="default-height">500</property>
+    <property name="default-width">1000</property>
+    <child type="titlebar">
+      <object class="GtkHeaderBar">
+        <property name="visible">True</property>
+        <property name="show-close-button">True</property>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <style>
+              <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkButton">
+                <property name="visible">True</property>
+                <property name="image">inspect_image</property>
+                <property name="tooltip-text">Inspect</property>
+                <signal name="clicked" handler="on_inspect"/>
+              </object>
+            </child>
+            <child>
+              <object class="GtkToggleButton">
+                <property name="visible">True</property>
+                <property name="image">update_image</property>
+                <property name="tooltip-text">Show Graphic Updates</property>
+                <signal name="toggled" handler="on_graphic_updates_toggled"/>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkNotebook">
+        <property name="visible">True</property>
+        <property name="show-border">False</property>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkInspectorButtonPath" id="button_path">
+                <property name="visible">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkPaned">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+                <child>
+                  <object class="GtkPaned">
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkScrolledWindow">
+                        <property name="visible">True</property>
+                        <property name="hscrollbar-policy">automatic</property>
+                        <property name="vscrollbar-policy">always</property>
+                        <property name="shadow-type">in</property>
+                        <property name="width-request">250</property>
+                        <property name="expand">True</property>
+                        <child>
+                          <object class="GtkInspectorWidgetTree" id="widget_tree">
+                            <property name="visible">True</property>
+                            <signal name="widget-changed" handler="on_widget_tree_selection_changed"/>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="resize">True</property>
+                        <property name="shrink">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkInspectorPythonShell" id="python_shell">
+                        <property name="visible">False</property>
+                      </object>
+                      <packing>
+                        <property name="resize">False</property>
+                        <property name="shrink">False</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="resize">True</property>
+                    <property name="shrink">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkNotebook">
+                    <property name="visible">True</property>
+                    <property name="enable-popup">True</property>
+                    <property name="show-border">False</property>
+                    <child>
+                      <object class="GtkScrolledWindow">
+                        <property name="visible">True</property>
+                        <property name="hscrollbar-policy">automatic</property>
+                        <property name="vscrollbar-policy">always</property>
+                        <property name="shadow-type">in</property>
+                        <property name="width-request">250</property>
+                        <child>
+                          <object class="GtkInspectorPropList" id="prop_list">
+                            <property name="visible">True</property>
+                            <property name="child-properties">False</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="tab">
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label">Properties</property>
+                      </object>
+                    </child> 
+                    <child>
+                      <object class="GtkScrolledWindow">
+                        <property name="visible">True</property>
+                        <property name="hscrollbar-policy">automatic</property>
+                        <property name="vscrollbar-policy">always</property>
+                        <property name="shadow-type">in</property>
+                        <property name="width-request">250</property>
+                        <child>
+                          <object class="GtkInspectorPropList" id="child_prop_list">
+                            <property name="visible">True</property>
+                            <property name="child-properties">True</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="tab">
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label">Child Properties</property>
+                      </object>
+                    </child> 
+                    <child>
+                      <object class="GtkInspectorObjectHierarchy" id="object_hierarchy">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child type="tab">
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label">Hierarchy</property>
+                      </object>
+                    </child> 
+                    <child>
+                      <object class="GtkInspectorClassesList" id="classes_list">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child type="tab">
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label">CSS Classes</property>
+                      </object>
+                    </child> 
+                    <child>
+                      <object class="GtkInspectorCssEditor" id="widget_css_editor">
+                        <property name="visible">True</property>
+                        <property name="global">False</property>
+                      </object>
+                    </child>
+                    <child type="tab">
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label">Custom CSS</property>
+                      </object>
+                    </child> 
+                  </object>
+                  <packing>
+                    <property name="resize">True</property>
+                    <property name="shrink">True</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label">Widget Tree</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkInspectorThemes">
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label">Themes</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkInspectorCssEditor">
+            <property name="visible">True</property>
+            <property name="global">True</property>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label">Custom CSS</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/modules/other/Makefile.am b/modules/other/Makefile.am
deleted file mode 100644 (file)
index e168924..0000000
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = parasite
diff --git a/modules/other/parasite/Makefile.am b/modules/other/parasite/Makefile.am
deleted file mode 100644 (file)
index 97dcd32..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-moduledir = $(libdir)/gtk-3.0/modules
-
-module_LTLIBRARIES = libgtkinspector.la
-
-resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/inspector.gresource.xml)
-resources.h: inspector.gresource.xml
-       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
-               --target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-header --manual-register
-resources.c: inspector.gresource.xml $(resource_files)
-       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
-               --target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-source --manual-register
-
-BUILT_SOURCES = \
-       resources.h \
-       resources.c
-
-libgtkinspector_la_SOURCES = \
-       resources.h \
-       resources.c \
-       inspect-button.c \
-       module.c \
-       prop-list.h \
-       prop-list.c \
-       property-cell-renderer.h \
-       property-cell-renderer.c \
-       python-hooks.h \
-       python-hooks.c \
-       python-shell.h \
-       python-shell.c \
-       widget-tree.h \
-       widget-tree.c \
-       window.h \
-       window.c \
-       button-path.h \
-       button-path.c \
-       classes-list.h \
-       classes-list.c \
-       css-editor.h \
-       css-editor.c \
-       object-hierarchy.h \
-       object-hierarchy.c \
-       themes.h \
-       themes.c
-
-libgtkinspector_la_CPPFLAGS = \
-       -I$(top_srcdir)                 \
-       -I$(top_srcdir)/gtk             \
-       -I$(top_builddir)/gtk           \
-       -I$(top_srcdir)/gdk             \
-       -I$(top_builddir)/gdk           \
-       -DGTK_DATADIR=\"$(datadir)\"    \
-       -DGTK_COMPILATION               \
-       $(GTK_DEP_CFLAGS)               \
-       $(GTK_DEBUG_FLAGS)
-
-if PLATFORM_WIN32
-no_undefined = -no-undefined
-endif
-
-libgtkinspector_la_LDFLAGS = -avoid-version -module $(no_undefined)
-
-libgtkinspector_la_LIBADD = \
-       $(top_builddir)/gtk/libgtk-3.la \
-       $(GTK_DEP_LIBS)
-
-EXTRA_DIST= \
-       $(resource_files)
-
--include $(top_srcdir)/git.mk
diff --git a/modules/other/parasite/button-path.c b/modules/other/parasite/button-path.c
deleted file mode 100644 (file)
index 339d4a1..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "button-path.h"
-
-struct _GtkInspectorButtonPathPrivate
-{
-  GtkWidget *sw;
-  GtkWidget *button_box;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorButtonPath, gtk_inspector_button_path, GTK_TYPE_BOX)
-
-static void
-gtk_inspector_button_path_init (GtkInspectorButtonPath *bp)
-{
-  bp->priv = gtk_inspector_button_path_get_instance_private (bp);
-  gtk_widget_init_template (GTK_WIDGET (bp));
-}
-
-static void
-gtk_inspector_button_path_class_init (GtkInspectorButtonPathClass *klass)
-{
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/button-path.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorButtonPath, sw);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorButtonPath, button_box);
-}
-
-GtkWidget *
-gtk_inspector_button_path_new (void)
-{
-  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_BUTTON_PATH, NULL));
-}
-
-void
-gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
-                                      GtkWidget          *widget)
-{
-  gchar *path, **words;
-  gint i;
-  GtkWidget *b;
-  GtkContainer *box = GTK_CONTAINER (bp->priv->button_box);
-
-  gtk_container_foreach (box, (GtkCallback)gtk_widget_destroy, NULL);
-
-  path = gtk_widget_path_to_string (gtk_widget_get_path (widget));
-  words = g_strsplit (path, " ", 0);
-
-  for (i = 0; i < g_strv_length (words); i++)
-    {
-      b = gtk_button_new_with_label (words[i]);
-      gtk_widget_show (b);
-      gtk_container_add (box, b);
-    }
-
-  g_strfreev (words);
-  g_free (path);
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/button-path.h b/modules/other/parasite/button-path.h
deleted file mode 100644 (file)
index 32f3d93..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_BUTTON_PATH_H_
-#define _GTK_INSPECTOR_BUTTON_PATH_H_
-
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_BUTTON_PATH            (gtk_inspector_button_path_get_type())
-#define GTK_INSPECTOR_BUTTON_PATH(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPath))
-#define GTK_INSPECTOR_BUTTON_PATH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPathClass))
-#define GTK_INSPECTOR_IS_BUTTON_PATH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH))
-#define GTK_INSPECTOR_IS_BUTTON_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_BUTTON_PATH))
-#define GTK_INSPECTOR_BUTTON_PATH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPathClass))
-
-
-typedef struct _GtkInspectorButtonPathPrivate GtkInspectorButtonPathPrivate;
-
-typedef struct _GtkInspectorButtonPath
-{
-  GtkBox parent;
-  GtkInspectorButtonPathPrivate *priv;
-} GtkInspectorButtonPath;
-
-typedef struct _GtkInspectorButtonPathClass
-{
-  GtkBoxClass parent;
-} GtkInspectorButtonPathClass;
-
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_button_path_get_type   (void);
-GtkWidget *gtk_inspector_button_path_new        (void);
-void       gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
-                                                 GtkWidget              *widget);
-
-G_END_DECLS
-
-
-#endif // _GTK_INSPECTOR_BUTTON_PATH_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/button-path.ui b/modules/other/parasite/button-path.ui
deleted file mode 100644 (file)
index e4addfb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <template class="GtkInspectorButtonPath" parent="GtkBox">
-    <property name="orientation">horizontal</property>
-    <child>
-      <object class="GtkScrolledWindow" id="sw">
-        <property name="visible">True</property>
-        <property name="hscrollbar-policy">automatic</property>
-        <property name="vscrollbar-policy">never</property>
-        <property name="hexpand">True</property>
-        <child>
-          <object class="GtkButtonBox" id="button_box">
-            <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
-            <property name="hexpand">True</property>
-            <property name="margin">6</property>
-            <property name="spacing">0</property>
-            <property name="layout-style">start</property>
-            <style>
-              <class name="linked"/>
-            </style>
-            <child>
-              <object class="GtkLabel">
-                <property name="visible">True</property>
-                <property name="label">Choose a widget through the inspector</property>
-                <property name="hexpand">True</property>
-                <property name="xalign">0.5</property>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/classes-list.c b/modules/other/parasite/classes-list.c
deleted file mode 100644 (file)
index 86d078e..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "classes-list.h"
-
-enum
-{
-  COLUMN_ENABLED,
-  COLUMN_NAME,
-  COLUMN_STYLE
-};
-
-typedef struct
-{
-  gboolean enabled;
-  PangoStyle style;
-} GtkInspectorClassesListByContext;
-
-struct _GtkInspectorClassesListPrivate
-{
-  GtkWidget *toolbar;
-  GtkWidget *view;
-  GtkTreeViewColumn *column;
-  GtkCellRenderer *name_renderer;
-  GtkListStore *model;
-  GHashTable *contexts;
-  GtkStyleContext *current_context;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorClassesList, gtk_inspector_classes_list, GTK_TYPE_BOX)
-
-static void
-enabled_toggled (GtkCellRendererToggle   *renderer,
-                 const gchar             *path,
-                 GtkInspectorClassesList *cl)
-{
-  GtkTreeIter iter;
-  gboolean enabled;
-  GHashTable *context;
-  GtkInspectorClassesListByContext *c;
-  gchar *name;
-
-  if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (cl->priv->model), &iter, path))
-    {
-      g_warning ("GtkInspector: Couldn't find the css class path for %s.", path);
-      return;
-    }
-
-  gtk_tree_model_get (GTK_TREE_MODEL (cl->priv->model), &iter,
-                      COLUMN_ENABLED, &enabled,
-                      COLUMN_NAME, &name,
-                      -1);
-  enabled = !enabled;
-  gtk_list_store_set (cl->priv->model, &iter,
-                      COLUMN_ENABLED, enabled,
-                      -1);
-
-  context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
-  if (context)
-    {
-      c = g_hash_table_lookup (context, name);
-      if (c)
-        {
-          c->enabled = enabled;
-          if (enabled)
-            gtk_style_context_add_class (cl->priv->current_context, name);
-          else
-            gtk_style_context_remove_class (cl->priv->current_context, name);
-        }
-      else
-        g_warning ("GtkInspector: Couldn't find the css class %s in the class hash table.", name);
-    }
-  else
-    g_warning ("GtkInspector: Couldn't find the hash table for the style context for css class %s.", name);
-}
-
-static void
-add_clicked (GtkButton               *button,
-             GtkInspectorClassesList *cl)
-{
-  GtkWidget *dialog, *content_area, *entry;
-
-  dialog = gtk_dialog_new_with_buttons ("New class",
-                                        GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (cl))),
-                                         GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
-                                         "_OK", GTK_RESPONSE_OK,
-                                         "Cancel", GTK_RESPONSE_CANCEL,
-                                         NULL);
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
-  entry = g_object_new (GTK_TYPE_ENTRY,
-                        "visible", TRUE,
-                        "margin", 5,
-                        "placeholder-text", "Class name",
-                        "activates-default", TRUE,
-                        NULL);
-  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-  gtk_container_add (GTK_CONTAINER (content_area), entry);
-
-  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
-    {
-      const gchar *name = gtk_entry_get_text (GTK_ENTRY (entry));
-      GHashTable *context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
-
-      if (*name && !g_hash_table_contains (context, name))
-        {
-          GtkTreeIter tree_iter;
-
-          gtk_style_context_add_class (cl->priv->current_context, name);
-
-          GtkInspectorClassesListByContext *c = g_new0 (GtkInspectorClassesListByContext, 1);
-          c->enabled = TRUE;
-          c->style = PANGO_STYLE_ITALIC;
-          g_hash_table_insert (context, (gpointer)g_strdup (name), c);
-
-          gtk_list_store_append (cl->priv->model, &tree_iter);
-          gtk_list_store_set (cl->priv->model, &tree_iter,
-                             COLUMN_ENABLED, TRUE,
-                             COLUMN_NAME, name,
-                             COLUMN_STYLE, PANGO_STYLE_ITALIC,
-                            -1);
-        }
-    }
-
-  gtk_widget_destroy (dialog);
-}
-
-static void
-read_classes_from_style_context (GtkInspectorClassesList *cl)
-{
-  GList *l, *classes;
-  GtkInspectorClassesListByContext *c;
-  GtkTreeIter tree_iter;
-  GHashTable *hash_context;
-
-  hash_context = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-  classes = gtk_style_context_list_classes (cl->priv->current_context);
-
-  for (l = classes; l; l = l->next)
-    {
-      c = g_new0 (GtkInspectorClassesListByContext, 1);
-      c->enabled = TRUE;
-      g_hash_table_insert (hash_context, g_strdup (l->data), c);
-
-      gtk_list_store_append (cl->priv->model, &tree_iter);
-      gtk_list_store_set (cl->priv->model, &tree_iter,
-                          COLUMN_ENABLED, TRUE,
-                          COLUMN_NAME, l->data,
-                          COLUMN_STYLE, PANGO_STYLE_NORMAL,
-                          -1);
-    }
-    g_list_free (classes);
-    g_hash_table_replace (cl->priv->contexts, cl->priv->current_context, hash_context);
-}
-
-static void
-restore_defaults_clicked (GtkButton           *button,
-                          GtkInspectorClassesList *cl)
-{
-  GHashTableIter hash_iter;
-  gchar *name;
-  GtkInspectorClassesListByContext *c;
-  GHashTable *hash_context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
-
-  g_hash_table_iter_init (&hash_iter, hash_context);
-  while (g_hash_table_iter_next (&hash_iter, (gpointer *)&name, (gpointer *)&c))
-    {
-      if (c->style == PANGO_STYLE_ITALIC)
-        gtk_style_context_remove_class (cl->priv->current_context, name);
-      else if (!c->enabled)
-        gtk_style_context_add_class (cl->priv->current_context, name);
-    }
-
-  gtk_list_store_clear (cl->priv->model);
-  read_classes_from_style_context (cl);
-}
-
-static void
-gtk_inspector_classes_list_init (GtkInspectorClassesList *cl)
-{
-  cl->priv = gtk_inspector_classes_list_get_instance_private (cl);
-  gtk_widget_init_template (GTK_WIDGET (cl));
-  cl->priv->contexts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)g_hash_table_destroy);
-}
-
-void
-gtk_inspector_classes_list_set_widget (GtkInspectorClassesList *cl,
-                                       GtkWidget               *widget)
-{
-  GtkStyleContext *widget_context;
-  GHashTable *hash_context;
-  GtkTreeIter tree_iter;
-  GtkInspectorClassesListByContext *c;
-
-  gtk_list_store_clear (cl->priv->model);
-
-  gtk_widget_set_sensitive (GTK_WIDGET (cl), TRUE);
-  widget_context = gtk_widget_get_style_context (widget);
-
-  cl->priv->current_context = widget_context;
-  gtk_widget_set_sensitive (cl->priv->toolbar, TRUE);
-
-  hash_context = g_hash_table_lookup (cl->priv->contexts, widget_context);
-  if (hash_context)
-    {
-      GHashTableIter hash_iter;
-      gchar *name;
-
-      g_hash_table_iter_init (&hash_iter, hash_context);
-      while (g_hash_table_iter_next (&hash_iter, (gpointer *)&name, (gpointer *)&c))
-        {
-          gtk_list_store_append (cl->priv->model, &tree_iter);
-          gtk_list_store_set (cl->priv->model, &tree_iter,
-                             COLUMN_ENABLED, c->enabled,
-                             COLUMN_NAME, name,
-                             COLUMN_STYLE, c->style,
-                            -1);
-        }
-    }
-  else
-    {
-      read_classes_from_style_context (cl);
-    }
-}
-
-static void
-gtk_inspector_classes_list_class_init (GtkInspectorClassesListClass *klass)
-{
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/classes-list.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, toolbar);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, view);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, model);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, column);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, name_renderer);
-  gtk_widget_class_bind_template_callback (widget_class, add_clicked);
-  gtk_widget_class_bind_template_callback (widget_class, restore_defaults_clicked);
-  gtk_widget_class_bind_template_callback (widget_class, enabled_toggled);
-}
-
-GtkWidget *
-gtk_inspector_classes_list_new (void)
-{
-  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_CLASSES_LIST, NULL));
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/classes-list.h b/modules/other/parasite/classes-list.h
deleted file mode 100644 (file)
index 6dfc0db..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef _GTK_INSPECTOR_CLASSES_LIST_H_
-#define _GTK_INSPECTOR_CLASSES_LIST_H_
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_CLASSES_LIST            (gtk_inspector_classes_list_get_type())
-#define GTK_INSPECTOR_CLASSES_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesList))
-#define GTK_INSPECTOR_CLASSES_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesListClass))
-#define GTK_INSPECTOR_IS_CLASSES_LIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST))
-#define GTK_INSPECTOR_IS_CLASSES_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CLASSES_LIST))
-#define GTK_INSPECTOR_CLASSES_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesListClass))
-
-
-typedef struct _GtkInspectorClassesListPrivate GtkInspectorClassesListPrivate;
-
-typedef struct _GtkInspectorClassesList
-{
-  GtkBox parent;
-  GtkInspectorClassesListPrivate *priv;
-} GtkInspectorClassesList;
-
-typedef struct _GtkInspectorClassesListClass
-{
-  GtkBoxClass parent;
-} GtkInspectorClassesListClass;
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_classes_list_get_type   (void);
-GtkWidget *gtk_inspector_classes_list_new        (void);
-void       gtk_inspector_classes_list_set_widget (GtkInspectorClassesList *cl,
-                                                  GtkWidget               *widget);
-
-G_END_DECLS
-
-#endif // _GTK_INSPECTOR_CLASSES_LIST_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/classes-list.ui b/modules/other/parasite/classes-list.ui
deleted file mode 100644 (file)
index 363b1ea..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkListStore" id="model">
-    <columns>
-      <column type="gboolean"/>
-      <column type="gchararray"/>
-      <column type="PangoStyle"/>
-    </columns>
-  </object>
-  <template class="GtkInspectorClassesList" parent="GtkBox">
-    <property name="orientation">vertical</property>
-    <child>
-      <object class="GtkToolbar" id="toolbar">
-        <property name="visible">True</property>
-        <property name="icon-size">small-toolbar</property>
-        <property name="sensitive">False</property>
-        <child>
-          <object class="GtkToolButton">
-            <property name="visible">True</property>
-            <property name="icon-name">list-add</property>
-            <property name="tooltip-text">Add a class</property>
-            <signal name="clicked" handler="add_clicked"/>
-          </object>
-        </child>
-        <child>
-          <object class="GtkToolButton">
-            <property name="visible">True</property>
-            <property name="icon-name">document-revert</property>
-            <property name="tooltip-text">Restore defaults for this widget</property>
-            <signal name="clicked" handler="restore_defaults_clicked"/>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkScrolledWindow">
-        <property name="visible">True</property>
-        <property name="expand">True</property>
-        <child>
-          <object class="GtkTreeView" id="view">
-            <property name="visible">True</property>
-            <property name="model">model</property>
-            <child>
-              <object class="GtkTreeViewColumn" id="column">
-                <property name="title">Name</property>
-                <child>
-                  <object class="GtkCellRendererToggle">
-                    <signal name="toggled" handler="enabled_toggled"/>
-                  </object>
-                  <attributes>
-                    <attribute name="active">0</attribute>
-                  </attributes>
-                </child>
-                <child>
-                  <object class="GtkCellRendererText" id="name_renderer">
-                    <property name="scale">0.8</property>
-                  </object>
-                  <attributes>
-                    <attribute name="text">1</attribute>
-                    <attribute name="style">2</attribute>
-                  </attributes>
-                </child>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/css-editor.c b/modules/other/parasite/css-editor.c
deleted file mode 100644 (file)
index e7f6a8c..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "css-editor.h"
-
-#define GTK_INSPECTOR_CSS_EDITOR_TEXT "inspector-css-editor-text"
-#define GTK_INSPECTOR_CSS_EDITOR_PROVIDER "inspector-css-editor-provider"
-
-enum
-{
-  COLUMN_ENABLED,
-  COLUMN_NAME,
-  COLUMN_USER
-};
-
-enum
-{
-  PROP_0,
-  PROP_GLOBAL
-};
-
-typedef struct
-{
-  gboolean enabled;
-  gboolean user;
-} GtkInspectorCssEditorByContext;
-
-struct _GtkInspectorCssEditorPrivate
-{
-  GtkWidget *toolbar;
-  GtkWidget *view;
-  GtkTextBuffer *text;
-  GtkCssProvider *provider;
-  gboolean global;
-  GtkStyleContext *selected_context;
-  GtkToggleToolButton *disable_button;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorCssEditor, gtk_inspector_css_editor, GTK_TYPE_BOX)
-
-static void
-set_initial_text (GtkInspectorCssEditor *editor)
-{
-  const gchar *initial_text_global =
-    "/*\n"
-    "You can type here any CSS rule recognized by GTK+.\n"
-    "You can temporarily disable this custom CSS by clicking on the \"Pause\" button above.\n\n"
-    "Changes are applied instantly and globally, for the whole application.\n"
-    "*/\n\n";
-  const gchar *initial_text_widget =
-    "/*\n"
-    "You can type here any CSS rule recognized by GTK+.\n"
-    "You can temporarily disable this custom CSS by clicking on the \"Pause\" button above.\n\n"
-    "Changes are applied instantly, only for this selected widget.\n"
-    "*/\n\n";
-  const gchar *text = NULL;
-
-  if (editor->priv->selected_context)
-    text = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_TEXT);
-  if (text)
-    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), text, -1);
-  else if (editor->priv->global)
-    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text_global, -1);
-  else
-    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text_widget, -1);
-}
-
-static void
-disable_toggled (GtkToggleToolButton   *button,
-                 GtkInspectorCssEditor *editor)
-{
-  if (gtk_toggle_tool_button_get_active (button))
-    {
-      if (editor->priv->global)
-        gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
-                                                      GTK_STYLE_PROVIDER (editor->priv->provider));
-      else if (editor->priv->selected_context)
-        gtk_style_context_remove_provider (editor->priv->selected_context,
-                                           GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER)));
-    }
-  else
-    {
-      if (editor->priv->global)
-        gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                                   GTK_STYLE_PROVIDER (editor->priv->provider),
-                                                   GTK_STYLE_PROVIDER_PRIORITY_USER);
-      else if (editor->priv->selected_context)
-        gtk_style_context_add_provider (editor->priv->selected_context,
-                                        GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER)),
-                                        G_MAXUINT);
-    }
-}
-
-static void
-apply_system_font (GtkInspectorCssEditor *editor)
-{
-  GSettings *s = g_settings_new ("org.gnome.desktop.interface");
-  gchar *font_name = g_settings_get_string (s, "monospace-font-name");
-  PangoFontDescription *font_desc = pango_font_description_from_string (font_name);
-
-  gtk_widget_override_font (editor->priv->view, font_desc);
-
-  pango_font_description_free (font_desc);
-  g_free (font_name);
-  g_object_unref (s);
-}
-
-static gchar *
-get_current_text (GtkTextBuffer *buffer)
-{
-  GtkTextIter start, end;
-
-  gtk_text_buffer_get_start_iter (buffer, &start);
-  gtk_text_buffer_get_end_iter (buffer, &end);
-  gtk_text_buffer_remove_all_tags (buffer, &start, &end);
-
-  return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-}
-
-static void
-text_changed (GtkTextBuffer         *buffer,
-              GtkInspectorCssEditor *editor)
-{
-  GtkCssProvider *provider;
-  gchar *text;
-
-  if (editor->priv->global)
-    provider = editor->priv->provider;
-  else if (editor->priv->selected_context)
-    provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
-  else
-    return;
-
-  text = get_current_text (buffer);
-  gtk_css_provider_load_from_data (provider, text, -1, NULL);
-  g_free (text);
-
-  gtk_style_context_reset_widgets (gdk_screen_get_default ());
-}
-
-static void
-show_parsing_error (GtkCssProvider        *provider,
-                    GtkCssSection         *section,
-                    const GError          *error,
-                    GtkInspectorCssEditor *editor)
-{
-  GtkTextIter start, end;
-  const char *tag_name;
-  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (editor->priv->text);
-
-  gtk_text_buffer_get_iter_at_line_index (buffer,
-                                          &start,
-                                          gtk_css_section_get_start_line (section),
-                                          gtk_css_section_get_start_position (section));
-  gtk_text_buffer_get_iter_at_line_index (buffer,
-                                          &end,
-                                          gtk_css_section_get_end_line (section),
-                                          gtk_css_section_get_end_position (section));
-
-  if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
-    tag_name = "warning";
-  else
-    tag_name = "error";
-
-  gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
-}
-
-static void
-create_provider (GtkInspectorCssEditor *editor)
-{
-  GtkCssProvider *provider = gtk_css_provider_new ();
-
-  if (editor->priv->global)
-    {
-      editor->priv->provider = provider;
-      gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                                 GTK_STYLE_PROVIDER (editor->priv->provider),
-                                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
-    }
-  else if (editor->priv->selected_context)
-    {
-      gtk_style_context_add_provider (editor->priv->selected_context,
-                                      GTK_STYLE_PROVIDER (provider),
-                                      G_MAXUINT);
-      g_object_set_data (G_OBJECT (editor->priv->selected_context),
-                         GTK_INSPECTOR_CSS_EDITOR_PROVIDER, provider);
-    }
-
-  g_signal_connect (provider, "parsing-error",
-                    G_CALLBACK (show_parsing_error), editor);
-}
-
-static void
-gtk_inspector_css_editor_init (GtkInspectorCssEditor *editor)
-{
-  editor->priv = gtk_inspector_css_editor_get_instance_private (editor);
-  gtk_widget_init_template (GTK_WIDGET (editor));
-}
-
-static void
-constructed (GObject *object)
-{
-  GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
-
-  gtk_widget_set_sensitive (GTK_WIDGET (editor), editor->priv->global);
-  create_provider (editor);
-  apply_system_font (editor);
-  set_initial_text (editor);
-}
-
-static void
-get_property (GObject    *object,
-              guint       param_id,
-              GValue     *value,
-              GParamSpec *pspec)
-{
-  GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
-
-  switch (param_id)
-    {
-      case PROP_GLOBAL:
-        g_value_set_boolean (value, editor->priv->global);
-        break;
-
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
-        break;
-    }
-}
-
-static void
-set_property (GObject      *object,
-              guint         param_id,
-              const GValue *value,
-              GParamSpec   *pspec)
-{
-  GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
-
-  switch (param_id)
-    {
-      case PROP_GLOBAL:
-        editor->priv->global = g_value_get_boolean (value);
-        break;
-
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
-        break;
-    }
-}
-
-static void
-gtk_inspector_css_editor_class_init (GtkInspectorCssEditorClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  object_class->get_property = get_property;
-  object_class->set_property = set_property;
-  object_class->constructed = constructed;
-
-  g_object_class_install_property (object_class, PROP_GLOBAL,
-      g_param_spec_boolean ("global", "Global", "Whether this editor changes the whole application or just the selected widget",
-                            TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/css-editor.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, toolbar);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, text);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, view);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, disable_button);
-  gtk_widget_class_bind_template_callback (widget_class, disable_toggled);
-  gtk_widget_class_bind_template_callback (widget_class, text_changed);
-}
-
-GtkWidget *
-gtk_inspector_css_editor_new (gboolean global)
-{
-  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_CSS_EDITOR,
-                                   "global", global,
-                                   NULL));
-}
-
-void
-gtk_inspector_css_editor_set_widget (GtkInspectorCssEditor *editor,
-                                     GtkWidget             *widget)
-{
-  gchar *text;
-  GtkCssProvider *provider;
-
-  g_return_if_fail (GTK_INSPECTOR_IS_CSS_EDITOR (editor));
-  g_return_if_fail (!editor->priv->global);
-
-  gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
-
-  if (editor->priv->selected_context)
-    {
-      text = get_current_text (GTK_TEXT_BUFFER (editor->priv->text));
-      g_object_set_data_full (G_OBJECT (editor->priv->selected_context),
-                              GTK_INSPECTOR_CSS_EDITOR_TEXT,
-                              text,
-                              g_free);
-    }
-
-  editor->priv->selected_context = gtk_widget_get_style_context (widget);
-
-  provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
-  if (!provider)
-    create_provider (editor);
-
-  set_initial_text (editor);
-  disable_toggled (editor->priv->disable_button, editor);
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/css-editor.h b/modules/other/parasite/css-editor.h
deleted file mode 100644 (file)
index 80be309..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef _GTK_INSPECTOR_CSS_EDITOR_H_
-#define _GTK_INSPECTOR_CSS_EDITOR_H_
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_CSS_EDITOR            (gtk_inspector_css_editor_get_type())
-#define GTK_INSPECTOR_CSS_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditor))
-#define GTK_INSPECTOR_CSS_EDITOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditorClass))
-#define GTK_INSPECTOR_IS_CSS_EDITOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR))
-#define GTK_INSPECTOR_IS_CSS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CSS_EDITOR))
-#define GTK_INSPECTOR_CSS_EDITOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditorClass))
-
-
-typedef struct _GtkInspectorCssEditorPrivate GtkInspectorCssEditorPrivate;
-
-typedef struct _GtkInspectorCssEditor
-{
-  GtkBox parent;
-  GtkInspectorCssEditorPrivate *priv;
-} GtkInspectorCssEditor;
-
-typedef struct _GtkInspectorCssEditorClass
-{
-  GtkBoxClass parent;
-} GtkInspectorCssEditorClass;
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_css_editor_get_type   (void);
-GtkWidget *gtk_inspector_css_editor_new        (gboolean               global);
-void       gtk_inspector_css_editor_set_widget (GtkInspectorCssEditor *editor,
-                                                GtkWidget             *widget);
-
-G_END_DECLS
-
-#endif // _GTK_INSPECTOR_CSS_EDITOR_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/css-editor.ui b/modules/other/parasite/css-editor.ui
deleted file mode 100644 (file)
index 7987d8a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkTextTagTable" id="tags">
-    <child type="tag">
-      <object class="GtkTextTag">
-        <property name="name">warning</property>
-        <property name="underline">single</property>
-      </object>
-      <object class="GtkTextTag">
-        <property name="name">error</property>
-        <property name="underline">error</property>
-      </object>
-    </child>
-  </object>
-  <object class="GtkTextBuffer" id="text">
-    <property name="tag-table">tags</property>
-    <signal name="changed" handler="text_changed"/>
-  </object>
-  <template class="GtkInspectorCssEditor" parent="GtkBox">
-    <property name="orientation">vertical</property>
-    <child>
-      <object class="GtkToolbar" id="toolbar">
-        <property name="visible">True</property>
-        <property name="icon-size">small-toolbar</property>
-        <child>
-          <object class="GtkToggleToolButton" id="disable_button">
-            <property name="visible">True</property>
-            <property name="icon-name">media-playback-pause</property>
-            <property name="tooltip-text">Disable this custom CSS</property>
-            <signal name="toggled" handler="disable_toggled"/>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkScrolledWindow">
-        <property name="visible">True</property>
-        <property name="expand">True</property>
-        <child>
-          <object class="GtkTextView" id="view">
-            <property name="visible">True</property>
-            <property name="buffer">text</property>
-            <property name="wrap-mode">word</property>
-          </object>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/inspect-button.c b/modules/other/parasite/inspect-button.c
deleted file mode 100644 (file)
index 6c6fbb5..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "window.h"
-#include "widget-tree.h"
-
-typedef struct
-{
-  gint x;
-  gint y;
-  gboolean found;
-  gboolean first;
-  GtkWidget *res_widget;
-} FindWidgetData;
-
-static void
-find_widget (GtkWidget      *widget,
-             FindWidgetData *data)
-{
-  GtkAllocation new_allocation;
-  gint x_offset = 0;
-  gint y_offset = 0;
-
-  gtk_widget_get_allocation (widget, &new_allocation);
-
-  if (data->found || !gtk_widget_get_mapped (widget))
-    return;
-
-  /* Note that in the following code, we only count the
-   * position as being inside a WINDOW widget if it is inside
-   * widget->window; points that are outside of widget->window
-   * but within the allocation are not counted. This is consistent
-   * with the way we highlight drag targets.
-   */
-  if (gtk_widget_get_has_window (widget))
-    {
-      new_allocation.x = 0;
-      new_allocation.y = 0;
-    }
-
-  if (gtk_widget_get_parent (widget) && !data->first)
-    {
-      GdkWindow *window = gtk_widget_get_window (widget);
-      while (window != gtk_widget_get_window (gtk_widget_get_parent (widget)))
-        {
-          gint tx, ty, twidth, theight;
-
-          twidth = gdk_window_get_width (window);
-          theight = gdk_window_get_height (window);
-
-          if (new_allocation.x < 0)
-            {
-              new_allocation.width += new_allocation.x;
-              new_allocation.x = 0;
-            }
-          if (new_allocation.y < 0)
-            {
-              new_allocation.height += new_allocation.y;
-              new_allocation.y = 0;
-            }
-          if (new_allocation.x + new_allocation.width > twidth)
-            new_allocation.width = twidth - new_allocation.x;
-          if (new_allocation.y + new_allocation.height > theight)
-            new_allocation.height = theight - new_allocation.y;
-
-          gdk_window_get_position (window, &tx, &ty);
-          new_allocation.x += tx;
-          x_offset += tx;
-          new_allocation.y += ty;
-          y_offset += ty;
-
-          window = gdk_window_get_parent (window);
-        }
-    }
-
-  if ((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
-      (data->x < new_allocation.x + new_allocation.width) &&
-      (data->y < new_allocation.y + new_allocation.height))
-    {
-      /* First, check if the drag is in a valid drop site in
-       * one of our children 
-       */
-      if (GTK_IS_CONTAINER (widget))
-        {
-          FindWidgetData new_data = *data;
-
-          new_data.x -= x_offset;
-          new_data.y -= y_offset;
-          new_data.found = FALSE;
-          new_data.first = FALSE;
-
-          gtk_container_forall (GTK_CONTAINER (widget),
-                                (GtkCallback)find_widget,
-                                &new_data);
-
-          data->found = new_data.found;
-          if (data->found)
-            data->res_widget = new_data.res_widget;
-        }
-
-      /* If not, and this widget is registered as a drop site, check to
-       * emit "drag_motion" to check if we are actually in
-       * a drop site.
-       */
-      if (!data->found)
-        {
-          data->found = TRUE;
-          data->res_widget = widget;
-        }
-    }
-}
-
-static GtkWidget *
-find_widget_at_pointer (GdkDevice *device)
-{
-  GtkWidget *widget = NULL;
-  GdkWindow *pointer_window;
-  gint x, y;
-  FindWidgetData data;
-
-  pointer_window = gdk_device_get_window_at_position (device, NULL, NULL);
-
-  if (pointer_window)
-    {
-      gpointer widget_ptr;
-
-      gdk_window_get_user_data (pointer_window, &widget_ptr);
-      widget = widget_ptr;
-    }
-
-  if (widget)
-    {
-      gdk_window_get_device_position (gtk_widget_get_window (widget),
-                                      device, &x, &y, NULL);
-
-      data.x = x;
-      data.y = y;
-      data.found = FALSE;
-      data.first = TRUE;
-
-      find_widget (widget, &data);
-      if (data.found)
-        return data.res_widget;
-
-      return widget;
-    }
-
-  return NULL;
-}
-
-static gboolean draw_flash (GtkWidget          *widget,
-                            cairo_t            *cr,
-                            GtkInspectorWindow *iw);
-
-static void
-clear_flash (GtkInspectorWindow *iw)
-{
-  if (iw->flash_widget)
-    {
-      gtk_widget_queue_draw (iw->flash_widget);
-      g_signal_handlers_disconnect_by_func (iw->flash_widget, draw_flash, iw);
-      iw->flash_widget = NULL;
-    }
-}
-
-static void
-start_flash (GtkInspectorWindow *iw,
-             GtkWidget          *widget)
-{
-  iw->flash_count = 1;
-  iw->flash_widget = widget;
-  g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), iw);
-  gtk_widget_queue_draw (widget);
-}
-
-static void
-on_inspect_widget (GtkWidget          *button,
-                   GdkEvent           *event,
-                   GtkInspectorWindow *iw)
-{
-  GtkWidget *widget;
-
-  clear_flash (iw);
-
-  widget = find_widget_at_pointer (gdk_event_get_device (event));
-
-  if (widget == NULL)
-    return;
-
-  iw->selected_widget = widget;
-
-  gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
-                                  gtk_widget_get_toplevel (widget));
-
-  gtk_inspector_widget_tree_select_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
-                                           G_OBJECT (widget));
-}
-
-static void
-on_highlight_widget (GtkWidget          *button,
-                     GdkEvent           *event,
-                     GtkInspectorWindow *iw)
-{
-  GtkWidget *widget;
-
-  widget = find_widget_at_pointer (gdk_event_get_device (event));
-
-  if (widget == NULL)
-    {
-      /* This window isn't in-process. Ignore it. */
-      return;
-    }
-
-  if (gtk_widget_get_toplevel (widget) == GTK_WIDGET (iw))
-    {
-      /* Don't hilight things in the inspector window */
-      return;
-    }
-
-  if (iw->flash_widget == widget)
-    {
-      /* Already selected */
-      return;
-    }
-
-  clear_flash (iw);
-  start_flash (iw, widget);
-}
-
-static gboolean
-property_query_event (GtkWidget *widget,
-                      GdkEvent  *event,
-                      gpointer   data)
-{
-  if (event->type == GDK_BUTTON_RELEASE)
-    {
-      g_signal_handlers_disconnect_by_func (widget, property_query_event, data);
-      gtk_grab_remove (widget);
-      gdk_device_ungrab (gdk_event_get_device (event), GDK_CURRENT_TIME);
-      on_inspect_widget (widget, event, data);
-    }
-  else if (event->type == GDK_MOTION_NOTIFY)
-    {
-      on_highlight_widget (widget, event, data);
-    }
-
-  return FALSE;
-}
-
-void
-on_inspect (GtkWidget          *button,
-            GtkInspectorWindow *iw)
-{
-  GdkDisplay *display;
-  GdkDevice *device;
-  GdkCursor *cursor;
-
-  g_signal_connect (button, "event",
-                    G_CALLBACK (property_query_event), iw);
-
-  display = gtk_widget_get_display (button);
-  cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
-  device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
-  gdk_device_grab (device,
-                   gtk_widget_get_window (GTK_WIDGET (button)),
-                   GDK_OWNERSHIP_NONE, TRUE,
-                   GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
-                   cursor, GDK_CURRENT_TIME);
-  g_object_unref (cursor);
-  gtk_grab_add (GTK_WIDGET (button));
-}
-
-GtkWidget *
-gtk_inspector_inspect_button_new (GtkInspectorWindow *iw)
-{
-  GtkWidget *button;
-
-  button = gtk_button_new_from_icon_name ("edit-find", GTK_ICON_SIZE_BUTTON);
-  gtk_widget_set_tooltip_text (button, "Inspect");
-  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_inspect), iw);
-
-  return button;
-}
-
-static gboolean
-draw_flash (GtkWidget          *widget,
-            cairo_t            *cr,
-            GtkInspectorWindow *iw)
-{
-  GtkAllocation alloc;
-
-  if (iw->flash_count % 2 == 0)
-    return FALSE;
-
-  if (GTK_IS_WINDOW (widget))
-    {
-      /* We don't want to draw the drag highlight around the
-       * CSD window decorations
-       */
-      gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN (widget)), &alloc);
-    }
-  else
-    {
-      alloc.x = 0;
-      alloc.y = 0;
-      alloc.width = gtk_widget_get_allocated_width (widget);
-      alloc.height = gtk_widget_get_allocated_height (widget);
-    }
-
-  cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.2);
-  cairo_rectangle (cr,
-                   alloc.x + 0.5, alloc.y + 0.5,
-                   alloc.width - 1, alloc.height - 1);
-  cairo_fill (cr);
-
-  return FALSE;
-}
-
-static gboolean
-on_flash_timeout (GtkInspectorWindow *iw)
-{
-  gtk_widget_queue_draw (iw->flash_widget);
-
-  iw->flash_count++;
-
-  if (iw->flash_count == 6)
-    {
-      g_signal_handlers_disconnect_by_func (iw->flash_widget, draw_flash, iw);
-      iw->flash_widget = NULL;
-      iw->flash_cnx = 0;
-
-      return G_SOURCE_REMOVE;
-    }
-
-  return G_SOURCE_CONTINUE;
-}
-
-void
-gtk_inspector_flash_widget (GtkInspectorWindow *iw,
-                            GtkWidget          *widget)
-{
-  if (iw->flash_cnx != 0)
-    return;
-
-  if (!gtk_widget_get_visible (widget) || !gtk_widget_get_mapped (widget))
-    return;
-
-  start_flash (iw, widget);
-  iw->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, iw);
-}
-
-/* vim: set et sw=2 ts=2: */
diff --git a/modules/other/parasite/inspector.gresource.xml b/modules/other/parasite/inspector.gresource.xml
deleted file mode 100644 (file)
index 145c883..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gresources>
-  <gresource prefix="/org/gtk/inspector">
-    <file>button-path.ui</file>
-    <file>object-hierarchy.ui</file>
-    <file>css-editor.ui</file>
-    <file>classes-list.ui</file>
-    <file>widget-tree.ui</file>
-    <file>prop-list.ui</file>
-    <file>themes.ui</file>
-    <file>window.ui</file>
-  </gresource>
-</gresources>
diff --git a/modules/other/parasite/module.c b/modules/other/parasite/module.c
deleted file mode 100644 (file)
index 2195d03..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#include <glib.h>
-
-#include "button-path.h"
-#include "classes-list.h"
-#include "css-editor.h"
-#include "object-hierarchy.h"
-#include "property-cell-renderer.h"
-#include "prop-list.h"
-#include "python-hooks.h"
-#include "python-shell.h"
-#include "resources.h"
-#include "themes.h"
-#include "widget-tree.h"
-#include "window.h"
-
-void
-gtk_module_init (gint *argc, gchar ***argv)
-{
-#ifdef ENABLE_PYTHON
-  gtk_inspector_python_init ();
-#endif
-
-  gtk_inspector_register_resource ();
-
-  g_type_ensure (GTK_TYPE_INSPECTOR_THEMES);
-  g_type_ensure (GTK_TYPE_INSPECTOR_CSS_EDITOR);
-  g_type_ensure (GTK_TYPE_INSPECTOR_BUTTON_PATH);
-  g_type_ensure (GTK_TYPE_INSPECTOR_WIDGET_TREE);
-  g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST);
-  g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY);
-  g_type_ensure (GTK_TYPE_INSPECTOR_CLASSES_LIST);
-  g_type_ensure (GTK_TYPE_INSPECTOR_PYTHON_SHELL);
-  g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
-  g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
-}
-
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/object-hierarchy.c b/modules/other/parasite/object-hierarchy.c
deleted file mode 100644 (file)
index 71af2bf..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "object-hierarchy.h"
-
-enum
-{
-  COLUMN_OBJECT_NAME
-};
-
-struct _GtkInspectorObjectHierarchyPrivate
-{
-  GtkTreeStore *model;
-  GtkTreeView *tree;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
-
-static void
-gtk_inspector_object_hierarchy_init (GtkInspectorObjectHierarchy *oh)
-{
-  oh->priv = gtk_inspector_object_hierarchy_get_instance_private (oh);
-  gtk_widget_init_template (GTK_WIDGET (oh));
-}
-
-static void
-gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *klass)
-{
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/object-hierarchy.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
-}
-
-GtkWidget *
-gtk_inspector_object_hierarchy_new (void)
-{
-  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, NULL));
-}
-
-void
-gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
-                                           GObject                     *object)
-{
-  GObjectClass *klass = G_OBJECT_GET_CLASS (object);
-  const gchar *class_name;
-  GtkTreeIter iter, parent;
-  GSList *list = NULL, *l;
-
-  gtk_tree_store_clear (oh->priv->model);
-
-  do
-    {
-      class_name = G_OBJECT_CLASS_NAME (klass);
-      list = g_slist_append (list, (gpointer)class_name);
-    }
-  while ((klass = g_type_class_peek_parent (klass)));
-  list = g_slist_reverse (list);
-
-  for (l = list; l; l = l->next)
-    {
-      gtk_tree_store_append (oh->priv->model, &iter, l == list ? NULL : &parent);
-      gtk_tree_store_set (oh->priv->model, &iter,
-                          COLUMN_OBJECT_NAME, l->data,
-                          -1);
-      parent = iter;
-    }
-
-  g_slist_free (list);
-
-  gtk_tree_view_expand_all (oh->priv->tree);
-  gtk_tree_selection_select_iter (gtk_tree_view_get_selection (oh->priv->tree), &iter);
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/object-hierarchy.h b/modules/other/parasite/object-hierarchy.h
deleted file mode 100644 (file)
index baa4093..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
-#define _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY            (gtk_inspector_object_hierarchy_get_type())
-#define GTK_INSPECTOR_OBJECT_HIERARCHY(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchy))
-#define GTK_INSPECTOR_OBJECT_HIERARCHY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass))
-#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY))
-#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY))
-#define GTK_INSPECTOR_OBJECT_HIERARCHY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass))
-
-
-typedef struct _GtkInspectorObjectHierarchyPrivate GtkInspectorObjectHierarchyPrivate;
-
-typedef struct _GtkInspectorObjectHierarchy
-{
-  GtkBox parent;
-  GtkInspectorObjectHierarchyPrivate *priv;
-} GtkInspectorObjectHierarchy;
-
-typedef struct _GtkInspectorObjectHierarchyClass
-{
-  GtkBoxClass parent;
-} GtkInspectorObjectHierarchyClass;
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_object_hierarchy_get_type   (void);
-GtkWidget *gtk_inspector_object_hierarchy_new        (void);
-void       gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
-                                                      GObject                     *object);
-
-G_END_DECLS
-
-#endif // _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/object-hierarchy.ui b/modules/other/parasite/object-hierarchy.ui
deleted file mode 100644 (file)
index 04d54e1..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkTreeStore" id="model">
-    <columns>
-      <column type="gchararray"/>
-    </columns>
-  </object>
-  <template class="GtkInspectorObjectHierarchy" parent="GtkBox">
-    <property name="orientation">horizontal</property>
-    <child>
-      <object class="GtkScrolledWindow">
-        <property name="visible">True</property>
-        <property name="expand">True</property>
-        <child>
-          <object class="GtkTreeView" id="tree">
-            <property name="visible">True</property>
-            <property name="model">model</property>
-            <child>
-              <object class="GtkTreeViewColumn">
-                <property name="title">Object Hierarchy</property>
-                <child>
-                  <object class="GtkCellRendererText">
-                    <property name="scale">0.8</property>
-                  </object>
-                  <attributes>
-                    <attribute name="text">0</attribute>
-                  </attributes> 
-                </child>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/prop-list.c b/modules/other/parasite/prop-list.c
deleted file mode 100644 (file)
index 938ee32..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "prop-list.h"
-#include "property-cell-renderer.h"
-
-
-enum
-{
-  COLUMN_NAME,
-  COLUMN_VALUE,
-  COLUMN_DEFINED_AT,
-  COLUMN_OBJECT,
-  COLUMN_TOOLTIP,
-  COLUMN_WRITABLE
-};
-
-enum
-{
-  PROP_0,
-  PROP_WIDGET_TREE,
-  PROP_CHILD_PROPERTIES
-};
-
-struct _GtkInspectorPropListPrivate
-{
-  GObject *object;
-  GtkListStore *model;
-  GHashTable *prop_iters;
-  GList *signal_cnxs;
-  GtkWidget *widget_tree;
-  GtkCellRenderer *value_renderer;
-  gboolean child_properties;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropList, gtk_inspector_prop_list, GTK_TYPE_TREE_VIEW)
-
-static void
-gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
-{
-  pl->priv = gtk_inspector_prop_list_get_instance_private (pl);
-  gtk_widget_init_template (GTK_WIDGET (pl));
-  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (pl->priv->model),
-                                        COLUMN_NAME,
-                                        GTK_SORT_ASCENDING);
-  pl->priv->prop_iters = g_hash_table_new_full (g_str_hash,
-                                                g_str_equal,
-                                                NULL,
-                                                (GDestroyNotify) gtk_tree_iter_free);
-}
-
-static void
-get_property (GObject    *object,
-              guint       param_id,
-              GValue     *value,
-              GParamSpec *pspec)
-{
-  GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
-
-  switch (param_id)
-    {
-      case PROP_WIDGET_TREE:
-        g_value_take_object (value, pl->priv->widget_tree);
-        g_object_set_data (G_OBJECT (pl->priv->value_renderer), "gtk_inspector-widget-tree", pl->priv->widget_tree);
-        break;
-
-      case PROP_CHILD_PROPERTIES:
-        g_value_set_boolean (value, pl->priv->child_properties);
-        g_object_set (pl->priv->value_renderer,
-                      "is-child-property", pl->priv->child_properties,
-                      NULL);
-        break;
-
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-        break;
-    }
-}
-
-static void
-set_property (GObject      *object,
-              guint         param_id,
-              const GValue *value,
-              GParamSpec   *pspec)
-{
-  GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
-
-  switch (param_id)
-    {
-      case PROP_WIDGET_TREE:
-        pl->priv->widget_tree = g_value_get_object (value);
-        break;
-
-      case PROP_CHILD_PROPERTIES:
-        pl->priv->child_properties = g_value_get_boolean (value);
-        break;
-
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-        break;
-    }
-}
-
-static void
-gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  object_class->get_property = get_property;
-  object_class->set_property = set_property;
-
-  g_object_class_install_property (object_class, PROP_WIDGET_TREE,
-      g_param_spec_object ("widget-tree", "Widget Tree", "Widget tree",
-                           GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-  g_object_class_install_property (object_class, PROP_CHILD_PROPERTIES,
-      g_param_spec_boolean ("child-properties", "Child properties", "Child properties",
-                            FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/prop-list.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, model);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, value_renderer);
-}
-
-static void
-gtk_inspector_prop_list_update_prop (GtkInspectorPropList *pl,
-                                     GtkTreeIter          *iter,
-                                     GParamSpec           *prop)
-{
-  GValue gvalue = {0};
-  gchar *value;
-
-  g_value_init(&gvalue, prop->value_type);
-  if (pl->priv->child_properties)
-    {
-      GtkWidget *parent;
-
-      parent = gtk_widget_get_parent (GTK_WIDGET (pl->priv->object));
-      gtk_container_child_get_property (GTK_CONTAINER (parent),
-                                        GTK_WIDGET (pl->priv->object),
-                                        prop->name, &gvalue);
-    }
-  else
-    g_object_get_property (pl->priv->object, prop->name, &gvalue);
-
-  if (G_VALUE_HOLDS_ENUM (&gvalue))
-    {
-      GEnumClass *enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
-      GEnumValue *enum_value = g_enum_get_value (enum_class, g_value_get_enum (&gvalue));
-
-      value = g_strdup (enum_value->value_name);
-    }
-  else
-    {
-      value = g_strdup_value_contents(&gvalue);
-    }
-
-  gtk_list_store_set (pl->priv->model, iter,
-                      COLUMN_NAME, prop->name,
-                      COLUMN_VALUE, value ? value : g_strdup (""),
-                      COLUMN_DEFINED_AT, g_type_name (prop->owner_type),
-                      COLUMN_OBJECT, pl->priv->object,
-                      COLUMN_TOOLTIP, g_param_spec_get_blurb (prop),
-                      COLUMN_WRITABLE, (prop->flags & G_PARAM_WRITABLE) != 0,
-                      -1);
-
-  g_free (value);
-  g_value_unset (&gvalue);
-}
-
-static void
-gtk_inspector_prop_list_prop_changed_cb (GObject              *pspec,
-                                         GParamSpec           *prop,
-                                         GtkInspectorPropList *pl)
-{
-  GtkTreeIter *iter = g_hash_table_lookup(pl->priv->prop_iters, prop->name);
-
-  if (iter != NULL)
-    gtk_inspector_prop_list_update_prop (pl, iter, prop);
-}
-
-GtkWidget *
-gtk_inspector_prop_list_new (GtkWidget *widget_tree,
-                             gboolean   child_properties)
-{
-  g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
-
-  return g_object_new (GTK_TYPE_INSPECTOR_PROP_LIST,
-                       "widget-tree", widget_tree,
-                       "child-properties", child_properties,
-                       NULL);
-}
-
-gboolean
-gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
-                                    GObject              *object)
-{
-  GtkTreeIter iter;
-  GParamSpec **props;
-  guint num_properties;
-  guint i;
-  GList *l;
-
-  if (pl->priv->object == object)
-    return FALSE;
-
-  pl->priv->object = object;
-
-  for (l = pl->priv->signal_cnxs; l != NULL; l = l->next)
-    {
-      gulong id = GPOINTER_TO_UINT (l->data);
-
-      if (g_signal_handler_is_connected (object, id))
-        g_signal_handler_disconnect (object, id);
-    }
-
-  g_list_free (pl->priv->signal_cnxs);
-  pl->priv->signal_cnxs = NULL;
-
-  g_hash_table_remove_all (pl->priv->prop_iters);
-  gtk_list_store_clear (pl->priv->model);
-  gtk_widget_set_sensitive (GTK_WIDGET (pl), FALSE);
-
-  if (pl->priv->child_properties)
-    {
-      GtkWidget *parent;
-
-      if (!GTK_IS_WIDGET (object))
-        return TRUE;
-
-      parent = gtk_widget_get_parent (GTK_WIDGET (object));
-      if (!parent)
-        return TRUE;
-
-      props = gtk_container_class_list_child_properties (G_OBJECT_GET_CLASS (parent), &num_properties);
-    }
-  else
-    props = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &num_properties);
-
-  gtk_widget_set_sensitive (GTK_WIDGET (pl), TRUE);
-
-  for (i = 0; i < num_properties; i++)
-    {
-      GParamSpec *prop = props[i];
-      gchar *signal_name;
-
-      if (! (prop->flags & G_PARAM_READABLE))
-        continue;
-
-      gtk_list_store_append (pl->priv->model, &iter);
-      gtk_inspector_prop_list_update_prop (pl, &iter, prop);
-
-      g_hash_table_insert (pl->priv->prop_iters, (gpointer) prop->name, gtk_tree_iter_copy (&iter));
-
-      /* Listen for updates */
-      if (pl->priv->child_properties)
-        signal_name = g_strdup_printf ("child-notify::%s", prop->name);
-      else
-        signal_name = g_strdup_printf ("notify::%s", prop->name);
-
-      pl->priv->signal_cnxs =
-          g_list_prepend (pl->priv->signal_cnxs,
-                          GINT_TO_POINTER (g_signal_connect(object, signal_name,
-                                                            G_CALLBACK (gtk_inspector_prop_list_prop_changed_cb), pl)));
-
-        g_free (signal_name);
-    }
-
-  return TRUE;
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/prop-list.h b/modules/other/parasite/prop-list.h
deleted file mode 100644 (file)
index c9dc42c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_PROP_LIST_H_
-#define _GTK_INSPECTOR_PROP_LIST_H_
-
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_PROP_LIST            (gtk_inspector_prop_list_get_type())
-#define GTK_INSPECTOR_PROP_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropList))
-#define GTK_INSPECTOR_PROP_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropListClass))
-#define GTK_INSPECTOR_IS_PROP_LIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROP_LIST))
-#define GTK_INSPECTOR_IS_PROP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROP_LIST))
-#define GTK_INSPECTOR_PROP_LIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropListClass))
-
-
-typedef struct _GtkInspectorPropListPrivate GtkInspectorPropListPrivate;
-
-typedef struct _GtkInspectorPropList
-{
-  GtkTreeView parent;
-  GtkInspectorPropListPrivate *priv;
-} GtkInspectorPropList;
-
-typedef struct _GtkInspectorPropListClass
-{
-  GtkTreeViewClass parent;
-} GtkInspectorPropListClass;
-
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_prop_list_get_type   (void);
-GtkWidget *gtk_inspector_prop_list_new        (GtkWidget            *widget_tree,
-                                               gboolean              child_properties);
-gboolean   gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
-                                               GObject              *object);
-
-G_END_DECLS
-
-#endif // _GTK_INSPECTOR_PROP_LIST_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/prop-list.ui b/modules/other/parasite/prop-list.ui
deleted file mode 100644 (file)
index a3064ac..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkListStore" id="model">
-    <columns>
-      <column type="gchararray"/>
-      <column type="gchararray"/>
-      <column type="gchararray"/>
-      <column type="GObject"/>
-      <column type="gchararray"/>
-      <column type="gboolean"/>
-    </columns>
-  </object>
-  <template class="GtkInspectorPropList" parent="GtkTreeView">
-    <property name="model">model</property>
-    <property name="tooltip-column">4</property>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Property</property>
-        <property name="resizable">True</property>
-        <property name="sort-order">ascending</property>
-        <property name="sort-column-id">0</property>
-        <child>
-          <object class="GtkCellRendererText">
-            <property name="scale">0.8</property>
-          </object>
-          <attributes>
-            <attribute name="text">0</attribute>
-            <attribute name="sensitive">5</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Value</property>
-        <property name="resizable">True</property>
-        <child>
-          <object class="GtkInspectorPropertyCellRenderer" id="value_renderer">
-            <property name="scale">0.8</property>
-            <property name="editable">True</property>
-          </object>
-          <attributes>
-            <attribute name="text">1</attribute>
-            <attribute name="object">3</attribute>
-            <attribute name="name">0</attribute>
-            <attribute name="sensitive">5</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Defined At</property>
-        <child>
-          <object class="GtkCellRendererText">
-            <property name="scale">0.8</property>
-          </object>
-          <attributes>
-            <attribute name="text">2</attribute>
-            <attribute name="sensitive">5</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/property-cell-renderer.c b/modules/other/parasite/property-cell-renderer.c
deleted file mode 100644 (file)
index a0a2cf9..0000000
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "property-cell-renderer.h"
-#include "widget-tree.h"
-
-struct _GtkInspectorPropertyCellRendererPrivate
-{
-  GObject *object;
-  char *name;
-  gboolean is_child_property;
-};
-
-enum
-{
-  PROP_0,
-  PROP_OBJECT,
-  PROP_NAME,
-  PROP_IS_CHILD_PROPERTY
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropertyCellRenderer, gtk_inspector_property_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT);
-
-static void
-gtk_inspector_property_cell_renderer_init(GtkInspectorPropertyCellRenderer *renderer)
-{
-  renderer->priv = gtk_inspector_property_cell_renderer_get_instance_private (renderer);
-}
-
-static void
-get_property (GObject    *object,
-              guint       param_id,
-              GValue     *value,
-              GParamSpec *pspec)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
-
-  switch (param_id)
-    {
-    case PROP_OBJECT:
-      g_value_set_object(value, r->priv->object);
-      break;
-
-    case PROP_NAME:
-      g_value_set_string(value, r->priv->name);
-      break;
-
-    case PROP_IS_CHILD_PROPERTY:
-      g_value_set_boolean (value, r->priv->is_child_property);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
-      break;
-    }
-}
-
-static void
-set_property (GObject      *object,
-              guint         param_id,
-              const GValue *value,
-              GParamSpec   *pspec)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
-
-  switch (param_id)
-    {
-    case PROP_OBJECT:
-      r->priv->object = g_value_get_object (value);
-      break;
-
-    case PROP_NAME:
-      g_free (r->priv->name);
-      r->priv->name = g_value_dup_string (value);
-      break;
-
-    case PROP_IS_CHILD_PROPERTY:
-      r->priv->is_child_property = g_value_get_boolean (value);
-      g_object_notify (object, "is-child-property");
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
-      break;
-    } 
-}
-
-static GParamSpec *
-find_property (GtkCellRenderer *renderer)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  if (r->priv->is_child_property)
-    {
-      GtkWidget *parent;
-
-      parent = gtk_widget_get_parent (GTK_WIDGET (r->priv->object));
-
-      return gtk_container_class_find_child_property (G_OBJECT_GET_CLASS (parent), r->priv->name);
-    }
-
-  return g_object_class_find_property (G_OBJECT_GET_CLASS (r->priv->object), r->priv->name);
-}
-
-static void
-get_value (GtkCellRenderer *renderer,
-           GValue          *gvalue)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  if (r->priv->is_child_property)
-    {
-      GtkWidget *widget;
-      GtkWidget *parent;
-
-      widget = GTK_WIDGET (r->priv->object);
-      parent = gtk_widget_get_parent (widget);
-
-      gtk_container_child_get_property (GTK_CONTAINER (parent), widget, r->priv->name, gvalue);
-    }
-  else
-    g_object_get_property (r->priv->object, r->priv->name, gvalue);
-}
-
-static void
-set_value (GtkCellRenderer *renderer,
-           GValue          *gvalue)
-{
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  if (r->priv->is_child_property)
-    {
-      GtkWidget *widget;
-      GtkWidget *parent;
-
-      widget = GTK_WIDGET (r->priv->object);
-      parent = gtk_widget_get_parent (widget);
-
-      gtk_container_child_set_property (GTK_CONTAINER (parent), widget, r->priv->name, gvalue);
-    }
-  else
-    g_object_set_property (r->priv->object, r->priv->name, gvalue);
-}
-
-static void
-stop_editing (GtkCellEditable *editable,
-              GtkCellRenderer *renderer)
-{
-  GValue gvalue = {0};
-  GParamSpec *prop;
-
-  prop = find_property (renderer);
-  g_value_init(&gvalue, prop->value_type);
-
-  if (GTK_IS_ENTRY(editable))
-    {
-      gboolean canceled;
-
-      g_object_get (editable, "editing-canceled", &canceled, NULL);
-      gtk_cell_renderer_stop_editing (renderer, canceled);
-
-      if (canceled)
-        return;
-
-      if (GTK_IS_SPIN_BUTTON(editable))
-        {
-          gdouble value = g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (editable)), NULL);
-
-          if (G_IS_PARAM_SPEC_INT (prop))
-            g_value_set_int (&gvalue, (gint)value);
-          else if G_IS_PARAM_SPEC_UINT (prop)
-            g_value_set_uint (&gvalue, (guint)value);
-          else if G_IS_PARAM_SPEC_INT64 (prop)
-            g_value_set_int64 (&gvalue, (gint64)value);
-          else if G_IS_PARAM_SPEC_UINT64 (prop)
-            g_value_set_uint64 (&gvalue, (guint64)value);
-          else if G_IS_PARAM_SPEC_LONG (prop)
-            g_value_set_long (&gvalue, (glong)value);
-          else if G_IS_PARAM_SPEC_ULONG (prop)
-            g_value_set_ulong (&gvalue, (gulong)value);
-          else if G_IS_PARAM_SPEC_DOUBLE (prop)
-            g_value_set_double (&gvalue, (gdouble)value);
-          else
-            return;
-        }
-      else
-        {
-          g_value_set_string (&gvalue, gtk_entry_get_text (GTK_ENTRY (editable)));
-        }
-    }
-  else if (GTK_IS_COMBO_BOX (editable))
-    {
-      /* We have no way of getting the canceled state for a GtkComboBox */
-      gtk_cell_renderer_stop_editing (renderer, FALSE);
-
-      if (G_IS_PARAM_SPEC_BOOLEAN (prop))
-        {
-          g_value_set_boolean (&gvalue, gtk_combo_box_get_active (GTK_COMBO_BOX (editable)) == 1);
-        }
-      else if (G_IS_PARAM_SPEC_ENUM (prop))
-        {
-          gchar *enum_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (editable));
-          GEnumClass *enum_class;
-          GEnumValue *enum_value;
-
-          if (enum_name == NULL)
-            return;
-
-          enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
-          enum_value = g_enum_get_value_by_name (enum_class, enum_name);
-          g_value_set_enum (&gvalue, enum_value->value);
-
-          g_free (enum_name);
-        }
-    }
-
-  set_value (renderer, &gvalue);
-  g_value_unset (&gvalue);
-}
-
-static GtkCellEditable *
-start_editing (GtkCellRenderer      *renderer,
-               GdkEvent             *event,
-               GtkWidget            *widget,
-               const gchar          *path,
-               const GdkRectangle   *background_area,
-               const GdkRectangle   *cell_area,
-               GtkCellRendererState  flags)
-{
-  PangoFontDescription *font_desc;
-  GtkCellEditable *editable = NULL;
-  GValue gvalue = {0};
-  GParamSpec *prop;
-  GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
-
-  prop = find_property (renderer);
-
-  g_value_init (&gvalue, prop->value_type);
-
-  get_value (renderer, &gvalue);
-
-  if (G_VALUE_HOLDS_OBJECT (&gvalue))
-    {
-      GtkInspectorWidgetTree *widget_tree = g_object_get_data (G_OBJECT (renderer), "gtk_inspector-widget-tree");
-      GObject *prop_object = g_value_get_object (&gvalue);
-      GtkTreeIter iter;
-
-      if (prop_object)
-        {
-          /* First check if the value is already in the tree (happens with 'parent' for instance) */
-          if (gtk_inspector_widget_tree_find_object (widget_tree, prop_object, &iter))
-            {
-              gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
-            }
-          else if (gtk_inspector_widget_tree_find_object (widget_tree, r->priv->object, &iter))
-            {
-              gtk_inspector_widget_tree_append_object (widget_tree, prop_object, &iter);
-              gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
-            }
-          else
-            {
-              g_warning ("GtkInspector: couldn't find the widget in the tree");
-            }
-        }
-      g_value_unset (&gvalue);
-      return NULL;
-    }
-  else
-    {
-      if (!(prop->flags & G_PARAM_WRITABLE))
-        return NULL;
-
-      if (G_VALUE_HOLDS_ENUM (&gvalue) || G_VALUE_HOLDS_BOOLEAN (&gvalue))
-        {
-          GtkWidget *combobox;
-          GList *renderers;
-
-          combobox = gtk_combo_box_text_new ();
-          gtk_widget_show (combobox);
-          g_object_set (G_OBJECT (combobox), "has-frame", FALSE, NULL);
-
-          if (G_VALUE_HOLDS_BOOLEAN (&gvalue))
-            {
-              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), "FALSE");
-              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), "TRUE");
-
-              gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), g_value_get_boolean (&gvalue) ? 1 : 0);
-            }
-          else if (G_VALUE_HOLDS_ENUM(&gvalue))
-            {
-              gint value = g_value_get_enum (&gvalue);
-              GEnumClass *enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
-              guint i;
-
-              for (i = 0; i < enum_class->n_values; i++)
-                {
-                  GEnumValue *enum_value = &enum_class->values[i];
-
-                  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox),
-                                                  enum_value->value_name);
-
-                  if (enum_value->value == value)
-                    gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), i);
-                }
-            }
-
-          renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (combobox));
-          g_object_set (G_OBJECT (renderers->data), "scale", 0.8, NULL);
-          g_list_free (renderers);
-
-          editable = GTK_CELL_EDITABLE (combobox);
-        }
-      else if (G_VALUE_HOLDS_STRING (&gvalue))
-        {
-          GtkWidget *entry;
-
-          entry = gtk_entry_new ();
-          gtk_widget_show (entry);
-          gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (&gvalue));
-
-          editable = GTK_CELL_EDITABLE (entry);
-        }
-      else if (G_VALUE_HOLDS_INT (&gvalue)    ||
-               G_VALUE_HOLDS_UINT (&gvalue)   ||
-               G_VALUE_HOLDS_INT64 (&gvalue)  ||
-               G_VALUE_HOLDS_UINT64 (&gvalue) ||
-               G_VALUE_HOLDS_LONG (&gvalue)   ||
-               G_VALUE_HOLDS_ULONG (&gvalue)  ||
-               G_VALUE_HOLDS_DOUBLE (&gvalue))
-        {
-          gdouble min, max, value;
-          GtkWidget *spinbutton;
-          guint digits = 0;
-
-          if (G_VALUE_HOLDS_INT (&gvalue))
-            {
-              GParamSpecInt *paramspec = G_PARAM_SPEC_INT (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_int (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_UINT (&gvalue))
-            {
-              GParamSpecUInt *paramspec = G_PARAM_SPEC_UINT (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_uint (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_INT64 (&gvalue))
-            {
-              GParamSpecInt64 *paramspec = G_PARAM_SPEC_INT64 (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_int64 (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_UINT64 (&gvalue))
-            {
-              GParamSpecUInt64 *paramspec = G_PARAM_SPEC_UINT64 (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_uint64 (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_LONG (&gvalue))
-            {
-              GParamSpecLong *paramspec = G_PARAM_SPEC_LONG (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_long (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_ULONG (&gvalue))
-            {
-              GParamSpecULong *paramspec = G_PARAM_SPEC_ULONG (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_ulong (&gvalue);
-            }
-          else if (G_VALUE_HOLDS_DOUBLE (&gvalue))
-            {
-              GParamSpecDouble *paramspec = G_PARAM_SPEC_DOUBLE (prop);
-              min = paramspec->minimum;
-              max = paramspec->maximum;
-              value = g_value_get_double (&gvalue);
-              digits = 2;
-            }
-          else
-            {
-              /* Shouldn't really be able to happen. */
-              return NULL;
-            }
-
-          spinbutton = gtk_spin_button_new_with_range (min, max, 1);
-          gtk_widget_show (spinbutton);
-          gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton), value);
-          gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
-
-          editable = GTK_CELL_EDITABLE(spinbutton);
-        }
-    }
-
-  g_value_unset (&gvalue);
-
-  if (!editable)
-    return NULL;
-
-  font_desc = pango_font_description_new ();
-  pango_font_description_set_size (font_desc, 8 * PANGO_SCALE);
-  gtk_widget_override_font (GTK_WIDGET (editable), font_desc);
-  pango_font_description_free (font_desc);
-
-  g_signal_connect (editable, "editing-done", G_CALLBACK (stop_editing), renderer);
-
-  return editable;
-}
-
-static void
-gtk_inspector_property_cell_renderer_class_init (GtkInspectorPropertyCellRendererClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
-
-  object_class->get_property = get_property;
-  object_class->set_property = set_property;
-
-  cell_class->start_editing = start_editing;
-
-  g_object_class_install_property (object_class, PROP_OBJECT,
-      g_param_spec_object ("object", "Object", "The object owning the property",
-                           G_TYPE_OBJECT, G_PARAM_READWRITE));
-
-  g_object_class_install_property (object_class, PROP_NAME,
-      g_param_spec_string ("name", "Name", "The property name",
-                           NULL, G_PARAM_READWRITE));
-
-  g_object_class_install_property (object_class, PROP_IS_CHILD_PROPERTY,
-      g_param_spec_boolean ("is-child-property", "Child property", "Child property",
-                            FALSE, G_PARAM_READWRITE));
-}
-
-GtkCellRenderer *
-gtk_inspector_property_cell_renderer_new (void)
-{
-  return g_object_new (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, NULL);
-}
-
-
-// vim: set et ts=2:
diff --git a/modules/other/parasite/property-cell-renderer.h b/modules/other/parasite/property-cell-renderer.h
deleted file mode 100644 (file)
index c8afeee..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
-#define _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
-
-
-#include <gtk/gtk.h>
-
-
-#define GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER            (gtk_inspector_property_cell_renderer_get_type())
-#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRenderer))
-#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
-#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
-#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
-#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
-
-typedef struct _GtkInspectorPropertyCellRendererPrivate GtkInspectorPropertyCellRendererPrivate;
-
-typedef struct
-{
-  GtkCellRendererText parent;
-  GtkInspectorPropertyCellRendererPrivate *priv;
-} GtkInspectorPropertyCellRenderer;
-
-typedef struct
-{
-  GtkCellRendererTextClass parent;
-} GtkInspectorPropertyCellRendererClass;
-
-
-G_BEGIN_DECLS
-
-
-GType            gtk_inspector_property_cell_renderer_get_type (void);
-GtkCellRenderer *gtk_inspector_property_cell_renderer_new      (void);
-
-
-G_END_DECLS
-
-
-#endif // _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/python-hooks.c b/modules/other/parasite/python-hooks.c
deleted file mode 100644 (file)
index 74d74fa..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#include <dlfcn.h>
-#include <signal.h>
-
-#ifdef ENABLE_PYTHON
-# include <Python.h>
-# include <pygobject.h>
-#endif
-
-#include "python-hooks.h"
-
-static gboolean python_enabled = FALSE;
-
-#ifdef ENABLE_PYTHON
-static GString *captured_stdout = NULL;
-static GString *captured_stderr = NULL;
-
-
-static PyObject *
-capture_stdout(PyObject *self, PyObject *args)
-{
-    char *str = NULL;
-
-    if (!PyArg_ParseTuple(args, "s", &str))
-        return NULL;
-
-    g_string_append(captured_stdout, str);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-static PyObject *
-capture_stderr(PyObject *self, PyObject *args)
-{
-    char *str = NULL;
-
-    if (!PyArg_ParseTuple(args, "s", &str))
-        return NULL;
-
-    g_string_append(captured_stderr, str);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-static PyObject *
-wrap_gobj(PyObject *self, PyObject *args)
-{
-    void *addr;
-    GObject *obj;
-
-    if (!PyArg_ParseTuple(args, "l", &addr))
-        return NULL;
-
-    if (!G_IS_OBJECT(addr))
-        return NULL; // XXX
-
-    obj = G_OBJECT(addr);
-
-    if (!obj)
-        return NULL; // XXX
-
-    return pygobject_new(obj);
-}
-
-static PyMethodDef gtk_inspector_python_methods[] = {
-    {"capture_stdout", capture_stdout, METH_VARARGS, "Captures stdout"},
-    {"capture_stderr", capture_stderr, METH_VARARGS, "Captures stderr"},
-    {"gobj", wrap_gobj, METH_VARARGS, "Wraps a C GObject"},
-    {NULL, NULL, 0, NULL}
-};
-
-
-static gboolean
-is_blacklisted(void)
-{
-    const char *prgname = g_get_prgname();
-
-    return (!strcmp(prgname, "gimp"));
-}
-#endif // ENABLE_PYTHON
-
-void
-gtk_inspector_python_init(void)
-{
-#ifdef ENABLE_PYTHON
-    int res;
-    struct sigaction old_sigint;
-
-    if (is_blacklisted())
-        return;
-
-    /* This prevents errors such as "undefined symbol: PyExc_ImportError" */
-    if (!dlopen(PYTHON_SHARED_LIB, RTLD_NOW | RTLD_GLOBAL))
-    {
-        g_error("%s\n", dlerror());
-        return;
-    }
-
-    captured_stdout = g_string_new("");
-    captured_stderr = g_string_new("");
-
-    /* Back up and later restore SIGINT so Python doesn't steal it from us. */
-    res = sigaction(SIGINT, NULL, &old_sigint);
-
-    if (!Py_IsInitialized())
-        Py_Initialize();
-
-    res = sigaction(SIGINT, &old_sigint, NULL);
-
-    Py_InitModule("gtk_inspector", gtk_inspector_python_methods);
-    PyRun_SimpleString(
-        "import gtk_inspector\n"
-        "import sys\n"
-        "\n"
-        "class StdoutCatcher:\n"
-        "    def write(self, str):\n"
-        "        gtk_inspector.capture_stdout(str)\n"
-        "\n"
-        "class StderrCatcher:\n"
-        "    def write(self, str):\n"
-        "        gtk_inspector.capture_stderr(str)\n"
-        "\n"
-    );
-
-    if (!pygobject_init(-1, -1, -1))
-    {
-        fprintf(stderr, "Error initializing pygobject support.\n");
-        PyErr_Print();
-        return;
-    }
-
-    char *argv[] = { "", NULL };
-    PySys_SetArgv(0, argv);
-
-    if (!PyImport_ImportModule("gi._gobject"))
-      {
-        PyErr_SetString(PyExc_ImportError, "could not import gi.gobject");
-        return;
-      }
-    if (!PyImport_ImportModule("gi.repository"))
-      {
-        PyErr_SetString(PyExc_ImportError, "could not import gi.repository");
-        return;
-      }
-    if (!PyImport_ImportModule("gi.repository.Gtk"))
-      {
-        PyErr_SetString(PyExc_ImportError, "could not import gtk");
-        return;
-      }
-
-    python_enabled = TRUE;
-#endif // ENABLE_PYTHON
-}
-
-void
-gtk_inspector_python_run(const char *command,
-                    GtkInspectorPythonLogger stdout_logger,
-                    GtkInspectorPythonLogger stderr_logger,
-                    gpointer user_data)
-{
-#ifdef ENABLE_PYTHON
-    PyGILState_STATE gstate;
-    PyObject *module;
-    PyObject *dict;
-    PyObject *obj;
-
-    gstate = PyGILState_Ensure();
-
-    module = PyImport_AddModule("__main__");
-    dict = PyModule_GetDict(module);
-
-    PyRun_SimpleString("old_stdout = sys.stdout\n"
-                       "old_stderr = sys.stderr\n"
-                       "sys.stdout = StdoutCatcher()\n"
-                       "sys.stderr = StderrCatcher()\n");
-
-    obj = PyRun_String(command, Py_single_input, dict, dict);
-
-    PyRun_SimpleString("sys.stdout = old_stdout\n"
-                       "sys.stderr = old_stderr\n");
-
-    if (stdout_logger != NULL)
-        stdout_logger(captured_stdout->str, user_data);
-
-    if (stderr_logger != NULL)
-        stderr_logger(captured_stderr->str, user_data);
-
-    // Print any returned object
-    if (obj != NULL && obj != Py_None) {
-       PyObject *repr = PyObject_Repr(obj);
-       if (repr != NULL) {
-           char *string = PyString_AsString(repr);
-
-           stdout_logger(string, user_data);
-           stdout_logger("\n", user_data);
-        }
-
-        Py_XDECREF(repr);
-    }
-    Py_XDECREF(obj);
-
-    PyGILState_Release(gstate);
-    g_string_erase(captured_stdout, 0, -1);
-    g_string_erase(captured_stderr, 0, -1);
-#endif // ENABLE_PYTHON
-}
-
-gboolean
-gtk_inspector_python_is_enabled(void)
-{
-    return python_enabled;
-}
-
-// vim: set et sw=4 ts=4:
diff --git a/modules/other/parasite/python-hooks.h b/modules/other/parasite/python-hooks.h
deleted file mode 100644 (file)
index 331fe74..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_PYTHON_MODULE_H_
-#define _GTK_INSPECTOR_PYTHON_MODULE_H_
-
-#include <glib.h>
-
-
-typedef void (*GtkInspectorPythonLogger)(const char *text, gpointer user_data);
-
-void gtk_inspector_python_init(void);
-void gtk_inspector_python_run(const char *command,
-                         GtkInspectorPythonLogger stdout_logger,
-                         GtkInspectorPythonLogger stderr_logger,
-                         gpointer user_data);
-gboolean gtk_inspector_python_is_enabled(void);
-
-#endif // _GTK_INSPECTOR_PYTHON_MODULE_H_
diff --git a/modules/other/parasite/python-shell.c b/modules/other/parasite/python-shell.c
deleted file mode 100644 (file)
index 5d13f78..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#include <gdk/gdkkeysyms.h>
-#include <string.h>
-
-#include "python-hooks.h"
-#include "python-shell.h"
-
-#define MAX_HISTORY_LENGTH 20
-
-struct _GtkInspectorPythonShellPrivate
-{
-    GtkWidget *textview;
-
-    GtkTextMark *scroll_mark;
-    GtkTextMark *line_start_mark;
-
-    GQueue *history;
-    GList *cur_history_item;
-
-    GString *pending_command;
-    gboolean in_block;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPythonShell, gtk_inspector_python_shell, GTK_TYPE_BOX);
-
-/* Widget functions */
-static void gtk_inspector_python_shell_finalize (GObject *obj);
-
-/* Python integration */
-static void gtk_inspector_python_shell_write_prompt(GtkWidget *python_shell);
-static char *gtk_inspector_python_shell_get_input(GtkWidget *python_shell);
-
-/* Callbacks */
-static gboolean gtk_inspector_python_shell_key_press_cb(GtkWidget *textview,
-                                                   GdkEventKey *event,
-                                                   GtkWidget *python_shell);
-static void
-gtk_inspector_python_shell_class_init(GtkInspectorPythonShellClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
-    object_class->finalize = gtk_inspector_python_shell_finalize;
-}
-
-static void
-gtk_inspector_python_shell_init (GtkInspectorPythonShell *python_shell)
-{
-    GtkWidget *swin;
-    GtkTextBuffer *buffer;
-    GtkTextIter iter;
-    PangoFontDescription *font_desc;
-
-    python_shell->priv = gtk_inspector_python_shell_get_instance_private (python_shell);
-
-    python_shell->priv->history = g_queue_new();
-
-    gtk_box_set_spacing(GTK_BOX(python_shell), 6);
-
-    swin = gtk_scrolled_window_new(NULL, NULL);
-    gtk_widget_show(swin);
-    gtk_box_pack_start(GTK_BOX(python_shell), swin, TRUE, TRUE, 0);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
-                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
-    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin),
-                                        GTK_SHADOW_IN);
-
-    python_shell->priv->textview = gtk_text_view_new();
-    gtk_widget_show(python_shell->priv->textview);
-    gtk_container_add(GTK_CONTAINER(swin), python_shell->priv->textview);
-    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(python_shell->priv->textview), TRUE);
-    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
-    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
-    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
-
-    g_signal_connect(python_shell->priv->textview, "key_press_event",
-                     G_CALLBACK(gtk_inspector_python_shell_key_press_cb),
-                     python_shell);
-
-    /* Make the textview monospaced */
-    font_desc = pango_font_description_from_string("monospace");
-    pango_font_description_set_size(font_desc, 8 * PANGO_SCALE);
-    gtk_widget_override_font(python_shell->priv->textview, font_desc);
-    pango_font_description_free(font_desc);
-
-    /* Create the end-of-buffer mark */
-    buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(python_shell->priv->textview));
-    gtk_text_buffer_get_end_iter(buffer, &iter);
-    python_shell->priv->scroll_mark = gtk_text_buffer_create_mark(buffer, "scroll_mark",
-                                                    &iter, FALSE);
-
-    /* Create the beginning-of-line mark */
-    python_shell->priv->line_start_mark = gtk_text_buffer_create_mark(buffer,
-                                                        "line_start_mark",
-                                                        &iter, TRUE);
-
-    /* Register some tags */
-    gtk_text_buffer_create_tag(buffer, "stdout", NULL);
-    gtk_text_buffer_create_tag(buffer, "stderr",
-                               "foreground", "red",
-                               "paragraph-background", "#FFFFE0",
-                               NULL);
-    gtk_text_buffer_create_tag(buffer, "prompt",
-                               "foreground", "blue",
-                               NULL);
-
-    gtk_inspector_python_shell_write_prompt(GTK_WIDGET(python_shell));
-}
-
-static void
-gtk_inspector_python_shell_finalize(GObject *python_shell)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-
-    g_queue_free(priv->history);
-}
-
-static void
-gtk_inspector_python_shell_log_stdout(const char *text, gpointer python_shell)
-{
-    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
-                                      text, "stdout");
-}
-
-static void
-gtk_inspector_python_shell_log_stderr(const char *text, gpointer python_shell)
-{
-    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
-                                      text, "stderr");
-}
-
-static void
-gtk_inspector_python_shell_write_prompt(GtkWidget *python_shell)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-    GtkTextBuffer *buffer =
-        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
-    GtkTextIter iter;
-    const char *prompt = (priv->pending_command == NULL ? ">>> " : "... ");
-
-    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
-                                      prompt, "prompt");
-
-    gtk_text_buffer_get_end_iter(buffer, &iter);
-    gtk_text_buffer_move_mark(buffer, priv->line_start_mark, &iter);
-}
-
-static void
-gtk_inspector_python_shell_process_line(GtkWidget *python_shell)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-    char *command = gtk_inspector_python_shell_get_input(python_shell);
-    char last_char;
-
-    gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
-                                      "\n", NULL);
-
-    if (*command != '\0')
-    {
-        /* Save this command in the history. */
-        g_queue_push_head(priv->history, command);
-        priv->cur_history_item = NULL;
-
-        if (g_queue_get_length(priv->history) > MAX_HISTORY_LENGTH)
-            g_free(g_queue_pop_tail(priv->history));
-    }
-
-    last_char = command[MAX(0, strlen(command) - 1)];
-
-    if (last_char == ':' || last_char == '\\' ||
-        (priv->in_block && g_ascii_isspace(command[0])))
-    {
-        printf("in block.. %c, %d, %d\n",
-               last_char, priv->in_block,
-               g_ascii_isspace(command[0]));
-        /* This is a multi-line expression */
-        if (priv->pending_command == NULL)
-            priv->pending_command = g_string_new(command);
-        else
-            g_string_append(priv->pending_command, command);
-
-        g_string_append_c(priv->pending_command, '\n');
-
-        if (last_char == ':')
-            priv->in_block = TRUE;
-    }
-    else
-    {
-        if (priv->pending_command != NULL)
-        {
-            g_string_append(priv->pending_command, command);
-            g_string_append_c(priv->pending_command, '\n');
-
-            /* We're not actually leaking this. It's in the history. */
-            command = g_string_free(priv->pending_command, FALSE);
-        }
-
-        gtk_inspector_python_run(command,
-                            gtk_inspector_python_shell_log_stdout,
-                            gtk_inspector_python_shell_log_stderr,
-                            python_shell);
-
-        if (priv->pending_command != NULL)
-        {
-            /* Now do the cleanup. */
-            g_free(command);
-            priv->pending_command = NULL;
-            priv->in_block = FALSE;
-        }
-    }
-
-    gtk_inspector_python_shell_write_prompt(python_shell);
-}
-
-static void
-gtk_inspector_python_shell_replace_input(GtkWidget *python_shell,
-                                    const char *text)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-    GtkTextBuffer *buffer =
-        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
-    GtkTextIter start_iter;
-    GtkTextIter end_iter;
-
-    gtk_text_buffer_get_iter_at_mark(buffer, &start_iter,
-                                     priv->line_start_mark);
-    gtk_text_buffer_get_end_iter(buffer, &end_iter);
-
-    gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
-    gtk_text_buffer_insert(buffer, &end_iter, text, -1);
-}
-
-static char *
-gtk_inspector_python_shell_get_input(GtkWidget *python_shell)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-    GtkTextBuffer *buffer =
-        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
-    GtkTextIter start_iter;
-    GtkTextIter end_iter;
-
-    gtk_text_buffer_get_iter_at_mark(buffer, &start_iter,
-                                     priv->line_start_mark);
-    gtk_text_buffer_get_end_iter(buffer, &end_iter);
-
-    return gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, FALSE);
-}
-
-static const char *
-gtk_inspector_python_shell_get_history_back(GtkWidget *python_shell)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-
-    if (priv->cur_history_item == NULL)
-    {
-        priv->cur_history_item = g_queue_peek_head_link(priv->history);
-
-        if (priv->cur_history_item == NULL)
-            return "";
-    }
-    else if (priv->cur_history_item->next != NULL)
-        priv->cur_history_item = priv->cur_history_item->next;
-
-    return (const char *)priv->cur_history_item->data;
-}
-
-static const char *
-gtk_inspector_python_shell_get_history_forward(GtkWidget *python_shell)
-{
-    GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-
-    if (priv->cur_history_item == NULL || priv->cur_history_item->prev == NULL)
-    {
-        priv->cur_history_item = NULL;
-        return "";
-    }
-
-    priv->cur_history_item = priv->cur_history_item->prev;
-
-    return (const char *)priv->cur_history_item->data;
-}
-
-static gboolean
-gtk_inspector_python_shell_key_press_cb(GtkWidget *textview,
-                                   GdkEventKey *event,
-                                   GtkWidget *python_shell)
-{
-    if (event->keyval == GDK_KEY_Return)
-    {
-        gtk_inspector_python_shell_process_line(python_shell);
-        return TRUE;
-    }
-    else if (event->keyval == GDK_KEY_Up)
-    {
-        gtk_inspector_python_shell_replace_input(python_shell,
-            gtk_inspector_python_shell_get_history_back(python_shell));
-        return TRUE;
-    }
-    else if (event->keyval == GDK_KEY_Down)
-    {
-        gtk_inspector_python_shell_replace_input(python_shell,
-            gtk_inspector_python_shell_get_history_forward(python_shell));
-        return TRUE;
-    }
-    else if (event->string != NULL)
-    {
-        GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
-        GtkTextBuffer *buffer =
-            gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
-        GtkTextMark *insert_mark = gtk_text_buffer_get_insert(buffer);
-        GtkTextMark *selection_mark =
-            gtk_text_buffer_get_selection_bound(buffer);
-        GtkTextIter insert_iter;
-        GtkTextIter selection_iter;
-        GtkTextIter start_iter;
-        gint cmp_start_insert;
-        gint cmp_start_select;
-        gint cmp_insert_select;
-
-        gtk_text_buffer_get_iter_at_mark(buffer, &start_iter,
-                                         priv->line_start_mark);
-        gtk_text_buffer_get_iter_at_mark(buffer, &insert_iter, insert_mark);
-        gtk_text_buffer_get_iter_at_mark(buffer, &selection_iter,
-                                         selection_mark);
-
-        cmp_start_insert = gtk_text_iter_compare(&start_iter, &insert_iter);
-        cmp_start_select = gtk_text_iter_compare(&start_iter, &selection_iter);
-        cmp_insert_select = gtk_text_iter_compare(&insert_iter,
-                                                  &selection_iter);
-
-        if (cmp_start_insert == 0 && cmp_start_select == 0 &&
-            (event->keyval == GDK_KEY_BackSpace ||
-             event->keyval == GDK_KEY_Left))
-        {
-            return TRUE;
-        }
-        if (cmp_start_insert <= 0 && cmp_start_select <= 0)
-        {
-            return FALSE;
-        }
-        else if (cmp_start_insert > 0 && cmp_start_select > 0)
-        {
-            gtk_text_buffer_place_cursor(buffer, &start_iter);
-        }
-        else if (cmp_insert_select < 0)
-        {
-            gtk_text_buffer_move_mark(buffer, insert_mark, &start_iter);
-        }
-        else if (cmp_insert_select > 0)
-        {
-            gtk_text_buffer_move_mark(buffer, selection_mark, &start_iter);
-        }
-    }
-
-    return FALSE;
-}
-
-GtkWidget *
-gtk_inspector_python_shell_new(void)
-{
-    return g_object_new(GTK_TYPE_INSPECTOR_PYTHON_SHELL, NULL);
-}
-
-void
-gtk_inspector_python_shell_append_text(GtkInspectorPythonShell *python_shell,
-                                  const char *str,
-                                  const char *tag)
-{
-    GtkInspectorPythonShellPrivate *priv = python_shell->priv;
-
-    GtkTextIter end;
-    GtkTextBuffer *buffer =
-        gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
-    GtkTextMark *mark = gtk_text_buffer_get_insert(buffer);
-
-    gtk_text_buffer_get_end_iter(buffer, &end);
-    gtk_text_buffer_move_mark(buffer, mark, &end);
-    gtk_text_buffer_insert_with_tags_by_name(buffer, &end, str, -1, tag, NULL);
-    gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(priv->textview), mark,
-                                 0, TRUE, 0, 1);
-}
-
-void
-gtk_inspector_python_shell_focus(GtkInspectorPythonShell *python_shell)
-{
-   gtk_widget_grab_focus (python_shell->priv->textview);
-}
-
-// vim: set et ts=4:
diff --git a/modules/other/parasite/python-shell.h b/modules/other/parasite/python-shell.h
deleted file mode 100644 (file)
index 9e002a9..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_PYTHON_SHELL_H_
-#define _GTK_INSPECTOR_PYTHON_SHELL_H_
-
-typedef struct _GtkInspectorPythonShell         GtkInspectorPythonShell;
-typedef struct _GtkInspectorPythonShellClass    GtkInspectorPythonShellClass;
-typedef struct _GtkInspectorPythonShellPrivate  GtkInspectorPythonShellPrivate;
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_PYTHON_SHELL (gtk_inspector_python_shell_get_type())
-#define GTK_INSPECTOR_PYTHON_SHELL(obj) \
-               (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShell))
-#define GTK_INSPECTOR_PYTHON_SHELL_CLASS(klass) \
-               (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShellClass))
-#define GTK_INSPECTOR_IS_PYTHON_SHELL(obj) \
-               (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL))
-#define GTK_INSPECTOR_IS_PYTHON_SHELL_CLASS(klass) \
-               (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PYTHON_SHELL))
-#define GTK_INSPECTOR_PYTHON_SHELL_GET_CLASS(obj) \
-               (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShellClass))
-
-
-struct _GtkInspectorPythonShell
-{
-  GtkBox parent_object;
-  GtkInspectorPythonShellPrivate *priv;
-};
-
-struct _GtkInspectorPythonShellClass
-{
- GtkBoxClass parent_class;
-};
-
-G_BEGIN_DECLS
-
-GType gtk_inspector_python_shell_get_type(void);
-
-GtkWidget *gtk_inspector_python_shell_new(void);
-void gtk_inspector_python_shell_append_text(GtkInspectorPythonShell *python_shell,
-                                       const char *str,
-                                       const char *tag);
-void gtk_inspector_python_shell_focus(GtkInspectorPythonShell *python_shell);
-
-G_END_DECLS
-
-#endif // _GTK_INSPECTOR_PYTHON_SHELL_H_
diff --git a/modules/other/parasite/themes.c b/modules/other/parasite/themes.c
deleted file mode 100644 (file)
index f2cb438..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "themes.h"
-
-struct _GtkInspectorThemesPrivate
-{
-  GtkWidget *dark_switch;
-  GtkWidget *theme_combo;
-  GtkWidget *icon_combo;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorThemes, gtk_inspector_themes, GTK_TYPE_LIST_BOX)
-
-static void
-init_dark (GtkInspectorThemes *pt)
-{
-  g_object_bind_property (pt->priv->dark_switch, "active",
-                          gtk_settings_get_default (), "gtk-application-prefer-dark-theme",
-                          G_BINDING_BIDIRECTIONAL);
-}
-
-static void
-fill_gtk (const gchar *path,
-          GHashTable  *t)
-{
-  const gchar *dir_entry;
-  GDir *dir = g_dir_open (path, 0, NULL);
-
-  if (!dir)
-    return;
-
-  while ((dir_entry = g_dir_read_name (dir)))
-    {
-      gchar *filename = g_build_filename (path, dir_entry, "gtk-3.0", "gtk.css", NULL);
-
-      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
-          !g_hash_table_contains (t, dir_entry))
-        g_hash_table_add (t, g_strdup (dir_entry));
-
-      g_free (filename);
-    }
-}
-
-static void
-init_theme (GtkInspectorThemes *pt)
-{
-  GHashTable *t;
-  GHashTableIter iter;
-  gchar *theme, *current_theme, *path;
-  gint i, pos;
-  GSettings *settings;
-
-  t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-  g_hash_table_add (t, g_strdup ("Raleigh"));
-
-  fill_gtk (GTK_DATADIR "/themes", t);
-  path = g_build_filename (g_get_user_data_dir (), "themes", NULL);
-  fill_gtk (path, t);
-  g_free (path);
-
-  settings = g_settings_new ("org.gnome.desktop.interface");
-  current_theme = g_settings_get_string (settings, "gtk-theme");
-  g_object_unref (settings);
-
-  g_hash_table_iter_init (&iter, t);
-  pos = i = 0;
-  while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
-    {
-      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pt->priv->theme_combo), theme);
-      if (g_strcmp0 (theme, current_theme) == 0)
-        pos = i;
-      i++;
-    }
-  g_hash_table_destroy (t);
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX (pt->priv->theme_combo), pos);
-}
-
-static void
-fill_icons (const gchar *path,
-            GHashTable  *t)
-{
-  const gchar *dir_entry;
-  GDir *dir = g_dir_open (path, 0, NULL);
-
-  if (!dir)
-    return;
-
-  while ((dir_entry = g_dir_read_name (dir)))
-    {
-      gchar *filename = g_build_filename (path, dir_entry, "index.theme", NULL);
-
-      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) &&
-          g_strcmp0 (dir_entry, "hicolor") != 0 &&
-          !g_hash_table_contains (t, dir_entry))
-        g_hash_table_add (t, g_strdup (dir_entry));
-
-      g_free (filename);
-    }
-}
-
-static void
-init_icons (GtkInspectorThemes *pt)
-{
-  GHashTable *t;
-  GHashTableIter iter;
-  gchar *theme, *current_theme, *path;
-  gint i, pos;
-  GSettings *settings;
-
-  t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
-  fill_icons (GTK_DATADIR "/icons", t);
-  path = g_build_filename (g_get_user_data_dir (), "icons", NULL);
-  fill_icons (path, t);
-  g_free (path);
-
-  settings = g_settings_new ("org.gnome.desktop.interface");
-  current_theme = g_settings_get_string (settings, "icon-theme");
-  g_object_unref (settings);
-
-  g_hash_table_iter_init (&iter, t);
-  pos = i = 0;
-  while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
-    {
-      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pt->priv->icon_combo), theme);
-      if (g_strcmp0 (theme, current_theme) == 0)
-        pos = i;
-      i++;
-    }
-  g_hash_table_destroy (t);
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX (pt->priv->icon_combo), pos);
-}
-
-static void
-theme_changed (GtkComboBox        *c,
-               GtkInspectorThemes *pt)
-{
-  gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
-  g_object_set (gtk_settings_get_default (), "gtk-theme-name", theme, NULL);
-  g_free (theme);
-}
-
-static void
-icons_changed (GtkComboBox        *c,
-               GtkInspectorThemes *pt)
-{
-  gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
-  g_object_set (gtk_settings_get_default (), "gtk-icon-theme-name", theme, NULL);
-  g_free (theme);
-}
-
-static void
-gtk_inspector_themes_init (GtkInspectorThemes *pt)
-{
-  pt->priv = gtk_inspector_themes_get_instance_private (pt);
-  gtk_widget_init_template (GTK_WIDGET (pt));
-
-  init_dark (pt);
-  init_theme (pt);
-  init_icons (pt);
-}
-
-static void
-gtk_inspector_themes_class_init (GtkInspectorThemesClass *klass)
-{
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/themes.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, dark_switch);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, theme_combo);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, icon_combo);
-
-  gtk_widget_class_bind_template_callback (widget_class, theme_changed);
-  gtk_widget_class_bind_template_callback (widget_class, icons_changed);
-}
-
-GtkWidget *
-gtk_inspector_themes_new (void)
-{
-  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_THEMES, NULL));
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/themes.h b/modules/other/parasite/themes.h
deleted file mode 100644 (file)
index f70fb79..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef _GTK_INSPECTOR_THEMES_H_
-#define _GTK_INSPECTOR_THEMES_H_
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_THEMES            (gtk_inspector_themes_get_type())
-#define GTK_INSPECTOR_THEMES(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemes))
-#define GTK_INSPECTOR_THEMES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
-#define GTK_INSPECTOR_IS_THEMES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_THEMES))
-#define GTK_INSPECTOR_IS_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_THEMES))
-#define GTK_INSPECTOR_THEMES_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
-
-
-typedef struct _GtkInspectorThemesPrivate GtkInspectorThemesPrivate;
-
-typedef struct _GtkInspectorThemes
-{
-  GtkListBox parent;
-  GtkInspectorThemesPrivate *priv;
-} GtkInspectorThemes;
-
-typedef struct _GtkInspectorThemesClass
-{
-  GtkListBoxClass parent;
-} GtkInspectorThemesClass;
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_themes_get_type (void);
-GtkWidget *gtk_inspector_themes_new      (void);
-
-G_END_DECLS
-
-#endif // _GTK_INSPECTOR_THEMES_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/themes.ui b/modules/other/parasite/themes.ui
deleted file mode 100644 (file)
index 1e94264..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <template class="GtkInspectorThemes" parent="GtkListBox">
-    <property name="selection-mode">none</property>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="margin">10</property>
-        <child>
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label">Use dark variant</property>
-            <property name="hexpand">True</property>
-            <property name="xalign">0.0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkSwitch" id="dark_switch">
-            <property name="visible">True</property>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="margin">10</property>
-        <child>
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label">GTK+ Theme</property>
-            <property name="hexpand">True</property>
-            <property name="xalign">0.0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkComboBoxText" id="theme_combo">
-            <property name="visible">True</property>
-            <signal name="changed" handler="theme_changed"/>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="margin">10</property>
-        <child>
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label">Icon Theme</property>
-            <property name="hexpand">True</property>
-            <property name="xalign">0.0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkComboBoxText" id="icon_combo">
-            <property name="visible">True</property>
-            <signal name="changed" handler="icons_changed"/>
-          </object>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/widget-tree.c b/modules/other/parasite/widget-tree.c
deleted file mode 100644 (file)
index 3dc585a..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "prop-list.h"
-#include "widget-tree.h"
-#include <string.h>
-
-enum
-{
-  OBJECT,
-  OBJECT_TYPE,
-  OBJECT_NAME,
-  WIDGET_REALIZED,
-  WIDGET_VISIBLE,
-  WIDGET_MAPPED,
-  OBJECT_ADDRESS,
-  SENSITIVE
-};
-
-
-enum
-{
-  WIDGET_CHANGED,
-  LAST_SIGNAL
-};
-
-
-struct _GtkInspectorWidgetTreePrivate
-{
-  GtkTreeStore *model;
-  GHashTable *iters;
-};
-
-static guint widget_tree_signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorWidgetTree, gtk_inspector_widget_tree, GTK_TYPE_TREE_VIEW)
-
-static void
-on_widget_selected (GtkTreeSelection       *selection,
-                    GtkInspectorWidgetTree *wt)
-{
-  g_signal_emit (wt, widget_tree_signals[WIDGET_CHANGED], 0);
-}
-
-
-static void
-gtk_inspector_widget_tree_init (GtkInspectorWidgetTree *wt)
-{
-  wt->priv = gtk_inspector_widget_tree_get_instance_private (wt);
-  wt->priv->iters = g_hash_table_new_full (g_direct_hash,
-                                           g_direct_equal,
-                                           NULL,
-                                           (GDestroyNotify) gtk_tree_iter_free);
-  gtk_widget_init_template (GTK_WIDGET (wt));
-
-  gtk_inspector_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
-}
-
-static void
-gtk_inspector_widget_tree_class_init (GtkInspectorWidgetTreeClass *klass)
-{
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  klass->widget_changed = NULL;
-
-  widget_tree_signals[WIDGET_CHANGED] =
-      g_signal_new ("widget-changed",
-                    G_OBJECT_CLASS_TYPE(klass),
-                    G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
-                    G_STRUCT_OFFSET(GtkInspectorWidgetTreeClass, widget_changed),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/widget-tree.ui");
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorWidgetTree, model);
-  gtk_widget_class_bind_template_callback (widget_class, on_widget_selected);
-}
-
-GtkWidget *
-gtk_inspector_widget_tree_new (void)
-{
-  return g_object_new (GTK_TYPE_INSPECTOR_WIDGET_TREE, NULL);
-}
-
-
-GObject *
-gtk_inspector_widget_tree_get_selected_object (GtkInspectorWidgetTree *wt)
-{
-  GtkTreeIter iter;
-  GtkTreeSelection *sel;
-  GtkTreeModel *model;
-
-  sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (wt));
-
-  if (gtk_tree_selection_get_selected (sel, &model, &iter))
-    {
-      GObject *object;
-      gtk_tree_model_get (model, &iter,
-                          OBJECT, &object,
-                          -1);
-      return object;
-    }
-
-  return NULL;
-}
-
-typedef struct
-{
-  GtkInspectorWidgetTree *wt;
-  GtkTreeIter *iter;
-} FindAllData;
-
-static void
-on_container_forall (GtkWidget *widget,
-                     gpointer   data)
-{
-  FindAllData *d = data;
-  gtk_inspector_widget_tree_append_object (d->wt, G_OBJECT (widget), d->iter);
-}
-
-void
-gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
-                                         GObject                *object,
-                                         GtkTreeIter            *parent_iter)
-{
-  GtkTreeIter iter;
-  const gchar *class_name = G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (object));
-  const gchar *name = NULL;
-  gchar *address;
-  gboolean realized;
-  gboolean mapped;
-  gboolean visible;
-  gboolean is_widget;
-
-  realized = mapped = visible = FALSE;
-
-  is_widget = GTK_IS_WIDGET (object);
-  if (is_widget)
-    {
-      GtkWidget *widget = GTK_WIDGET (object);
-      name = gtk_widget_get_name (GTK_WIDGET (object));
-      realized = gtk_widget_get_realized  (widget);
-      mapped = gtk_widget_get_mapped (widget);
-      visible = gtk_widget_get_visible (widget);
-    }
-
-  if (name == NULL || g_strcmp0 (name, class_name) == 0)
-    {
-      if (GTK_IS_LABEL (object))
-        name = gtk_label_get_text (GTK_LABEL (object));
-      else if (GTK_IS_BUTTON (object))
-        name = gtk_button_get_label (GTK_BUTTON (object));
-      else if (GTK_IS_WINDOW (object))
-        name = gtk_window_get_title (GTK_WINDOW (object));
-      else
-        name = "";
-    }
-
-  address = g_strdup_printf ("%p", object);
-
-  gtk_tree_store_append (wt->priv->model, &iter, parent_iter);
-  gtk_tree_store_set (wt->priv->model, &iter,
-                      OBJECT, object,
-                      OBJECT_TYPE, class_name,
-                      OBJECT_NAME, name,
-                      WIDGET_REALIZED, realized,
-                      WIDGET_MAPPED, mapped,
-                      WIDGET_VISIBLE, visible,
-                      OBJECT_ADDRESS, address,
-                      SENSITIVE, !is_widget || (realized && mapped && visible),
-                      -1);
-  g_hash_table_insert (wt->priv->iters, object, gtk_tree_iter_copy (&iter));
-
-  g_free(address);
-
-  if (GTK_IS_CONTAINER (object))
-    {
-      FindAllData data;
-
-      data.wt = wt;
-      data.iter = &iter;
-
-      gtk_container_forall (GTK_CONTAINER (object), on_container_forall, &data);
-    }
-}
-
-void
-gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt,
-                                GtkWidget              *window)
-{
-  gtk_tree_store_clear (wt->priv->model);
-  g_hash_table_remove_all (wt->priv->iters);
-  gtk_inspector_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
-  gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL);
-
-  gtk_tree_view_columns_autosize (GTK_TREE_VIEW (wt));
-}
-
-gboolean
-gtk_inspector_widget_tree_find_object (GtkInspectorWidgetTree *wt,
-                                       GObject                *object,
-                                       GtkTreeIter            *iter)
-{
-  GtkTreeIter *internal_iter = g_hash_table_lookup (wt->priv->iters, object);
-  if (internal_iter)
-    {
-      *iter = *internal_iter;
-      return TRUE;
-    }
-
-  return FALSE;
-}
-
-void
-gtk_inspector_widget_tree_select_object (GtkInspectorWidgetTree *wt,
-                                         GObject                *object)
-{
-  GtkTreeIter iter;
-
-  if (gtk_inspector_widget_tree_find_object (wt, object, &iter))
-    {
-      GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (wt->priv->model), &iter);
-      gtk_tree_view_expand_to_path (GTK_TREE_VIEW (wt), path);
-      gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (wt)), &iter);
-      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (wt), path, NULL, FALSE, 0, 0);
-    }
-}
-
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/widget-tree.h b/modules/other/parasite/widget-tree.h
deleted file mode 100644 (file)
index d3616e2..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_WIDGET_TREE_H_
-#define _GTK_INSPECTOR_WIDGET_TREE_H_
-
-
-#include <gtk/gtk.h>
-
-
-#define GTK_TYPE_INSPECTOR_WIDGET_TREE            (gtk_inspector_widget_tree_get_type())
-#define GTK_INSPECTOR_WIDGET_TREE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTree))
-#define GTK_INSPECTOR_WIDGET_TREE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTreeClass))
-#define GTK_INSPECTOR_IS_WIDGET_TREE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE))
-#define GTK_INSPECTOR_IS_WIDGET_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_WIDGET_TREE))
-#define GTK_INSPECTOR_WIDGET_TREE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTreeClass))
-
-
-typedef struct _GtkInspectorWidgetTreePrivate GtkInspectorWidgetTreePrivate;
-
-typedef struct _GtkInspectorWidgetTree
-{
-  GtkTreeView parent;
-  GtkInspectorWidgetTreePrivate *priv;
-} GtkInspectorWidgetTree;
-
-typedef struct _GtkInspectorWidgetTreeClass
-{
-  GtkTreeViewClass parent;
-
-  void (*widget_changed) (GtkInspectorWidgetTree *tree);
-} GtkInspectorWidgetTreeClass;
-
-
-G_BEGIN_DECLS
-
-
-GType      gtk_inspector_widget_tree_get_type            (void);
-GtkWidget *gtk_inspector_widget_tree_new                 (void);
-
-GObject   *gtk_inspector_widget_tree_get_selected_object (GtkInspectorWidgetTree *wt);
-
-void       gtk_inspector_widget_tree_scan                (GtkInspectorWidgetTree *wt,
-                                                          GtkWidget              *window);
-void       gtk_inspector_widget_tree_select_object       (GtkInspectorWidgetTree *wt,
-                                                          GObject                *object);
-void       gtk_inspector_widget_tree_append_object       (GtkInspectorWidgetTree *wt,
-                                                          GObject                *object,
-                                                          GtkTreeIter            *parent_iter);
-gboolean   gtk_inspector_widget_tree_find_object         (GtkInspectorWidgetTree *wt,
-                                                          GObject                *object,
-                                                          GtkTreeIter            *iter);
-
-G_END_DECLS
-
-
-#endif // _GTK_INSPECTOR_WIDGETTREE_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/widget-tree.ui b/modules/other/parasite/widget-tree.ui
deleted file mode 100644 (file)
index 9a53d5f..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkTreeStore" id="model">
-    <columns>
-      <column type="gpointer"/>
-      <column type="gchararray"/>
-      <column type="gchararray"/>
-      <column type="gboolean"/>
-      <column type="gboolean"/>
-      <column type="gboolean"/>
-      <column type="gchararray"/>
-      <column type="gboolean"/>
-    </columns>
-  </object>
-  <template class="GtkInspectorWidgetTree" parent="GtkTreeView">
-    <property name="model">model</property>
-    <property name="enable-search">True</property>
-    <property name="search-column">2</property>
-    <child internal-child="selection">
-      <object class="GtkTreeSelection">
-        <signal name="changed" handler="on_widget_selected"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Widget</property>
-        <property name="resizable">True</property>
-        <child>
-          <object class="GtkCellRendererText">
-            <property name="scale">0.8</property>
-          </object>
-          <attributes>
-            <attribute name="text">1</attribute>
-            <attribute name="sensitive">7</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Name</property>
-        <property name="resizable">True</property>
-        <child>
-          <object class="GtkCellRendererText">
-            <property name="scale">0.8</property>
-          </object>
-          <attributes>
-            <attribute name="text">2</attribute>
-            <attribute name="sensitive">7</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Realized</property>
-        <child>
-          <object class="GtkCellRendererToggle">
-            <property name="activatable">True</property>
-            <property name="indicator-size">10</property>
-          </object>
-          <attributes>
-            <attribute name="active">3</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Mapped</property>
-        <child>
-          <object class="GtkCellRendererToggle">
-            <property name="activatable">True</property>
-            <property name="indicator-size">10</property>
-          </object>
-          <attributes>
-            <attribute name="active">4</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Visible</property>
-        <child>
-          <object class="GtkCellRendererToggle">
-            <property name="activatable">True</property>
-            <property name="indicator-size">10</property>
-          </object>
-          <attributes>
-            <attribute name="active">5</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkTreeViewColumn">
-        <property name="title">Address</property>
-        <property name="resizable">True</property>
-        <child>
-          <object class="GtkCellRendererText">
-            <property name="scale">0.8</property>
-            <property name="family">monospace</property>
-          </object>
-          <attributes>
-            <attribute name="text">6</attribute>
-            <attribute name="sensitive">7</attribute>
-          </attributes>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>
diff --git a/modules/other/parasite/window.c b/modules/other/parasite/window.c
deleted file mode 100644 (file)
index 4383e48..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- * Copyright (c) 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include "window.h"
-#include "prop-list.h"
-#include "property-cell-renderer.h"
-#include "classes-list.h"
-#include "css-editor.h"
-#include "object-hierarchy.h"
-#include "widget-tree.h"
-#include "python-hooks.h"
-#include "python-shell.h"
-#include "button-path.h"
-#include "themes.h"
-
-G_DEFINE_TYPE (GtkInspectorWindow, gtk_inspector_window, GTK_TYPE_WINDOW)
-
-extern void on_inspect (GtkWidget *button, GtkInspectorWindow *iw);
-
-static void
-on_graphic_updates_toggled (GtkToggleButton    *button,
-                            GtkInspectorWindow *iw)
-{
-  gdk_window_set_debug_updates (gtk_toggle_button_get_active (button));
-}
-
-static gboolean
-on_widget_tree_button_press (GtkInspectorWidgetTree *wt,
-                             GdkEventButton         *event,
-                             GtkInspectorWindow     *iw)
-{
-  if (event->button == 3)
-    gtk_menu_popup (GTK_MENU (iw->widget_popup), NULL, NULL,
-                    NULL, NULL, event->button, event->time);
-
-  return FALSE;
-}
-
-static void
-on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
-                                  GtkInspectorWindow     *iw)
-{
-  GObject *selected = gtk_inspector_widget_tree_get_selected_object (wt);
-
-  if (selected != NULL)
-    {
-      if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
-        return;
-
-      gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
-      gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
-
-      if (GTK_IS_WIDGET (selected))
-        {
-          GtkWidget *widget = GTK_WIDGET (selected);
-
-          gtk_inspector_flash_widget (iw, widget);
-          gtk_inspector_button_path_set_widget (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), widget);
-          gtk_inspector_classes_list_set_widget (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), widget);
-          gtk_inspector_css_editor_set_widget (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), widget);
-        }
-      else
-        {
-          gtk_widget_set_sensitive (iw->classes_list, FALSE);
-          gtk_widget_set_sensitive (iw->widget_css_editor, FALSE);
-        }
-    }
-}
-
-static void
-on_send_widget_to_shell_activate (GtkWidget          *menuitem,
-                                  GtkInspectorWindow *iw)
-{
-  gchar *str;
-  GObject *object;
-
-  object = gtk_inspector_widget_tree_get_selected_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree));
-
-  if (!object)
-    return;
-
-  str = g_strdup_printf ("gtk_inspector.gobj(%p)", object);
-  gtk_inspector_python_shell_append_text (GTK_INSPECTOR_PYTHON_SHELL (iw->python_shell),
-                                     str,
-                                     NULL);
-
-  g_free (str);
-  gtk_inspector_python_shell_focus (GTK_INSPECTOR_PYTHON_SHELL (iw->python_shell));
-}
-
-static void
-gtk_inspector_window_init (GtkInspectorWindow *iw)
-{
-  gchar *title;
-
-  gtk_widget_init_template (GTK_WIDGET (iw));
-
-  gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));
-
-  title = g_strdup_printf ("GTK+ Inspector — %s", g_get_application_name ());
-  gtk_window_set_title (GTK_WINDOW (iw), title);
-  g_free (title);
-
-  if (gtk_inspector_python_is_enabled ())
-    {
-      gtk_widget_show (iw->python_shell);
-      g_signal_connect (G_OBJECT (iw->widget_tree), "button-press-event",
-                        G_CALLBACK (on_widget_tree_button_press), iw);
-    }
-}
-
-static void
-gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
-{
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/window.ui");
-
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_tree);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, prop_list);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, child_prop_list);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, button_path);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, classes_list);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_css_editor);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_hierarchy);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, python_shell);
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_popup);
-
-  gtk_widget_class_bind_template_callback (widget_class, on_inspect);
-  gtk_widget_class_bind_template_callback (widget_class, on_graphic_updates_toggled);
-  gtk_widget_class_bind_template_callback (widget_class, on_widget_tree_selection_changed);
-  gtk_widget_class_bind_template_callback (widget_class, on_send_widget_to_shell_activate);
-}
-
-GtkWidget *
-gtk_inspector_window_new (void)
-{
-  return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_WINDOW, NULL));
-}
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/window.h b/modules/other/parasite/window.h
deleted file mode 100644 (file)
index 0c5e9cc..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2008-2009  Christian Hammond
- * Copyright (c) 2008-2009  David Trowbridge
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef _GTK_INSPECTOR_WINDOW_H_
-#define _GTK_INSPECTOR_WINDOW_H_
-
-
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_INSPECTOR_WINDOW            (gtk_inspector_window_get_type())
-#define GTK_INSPECTOR_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindow))
-#define GTK_INSPECTOR_WINDOW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindowClass))
-#define GTK_INSPECTOR_IS_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_WINDOW))
-#define GTK_INSPECTOR_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_WINDOW))
-#define GTK_INSPECTOR_WINDOW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindowClass))
-
-
-#define TREE_TEXT_SCALE 0.8
-#define TREE_CHECKBOX_SIZE (gint)(0.8 * 13)
-
-typedef struct
-{
-  GtkWindow parent;
-
-  GtkWidget *widget_tree;
-  GtkWidget *prop_list;
-  GtkWidget *child_prop_list;
-  GtkWidget *python_shell;
-  GtkWidget *button_path;
-  GtkWidget *classes_list;
-  GtkWidget *widget_css_editor;
-  GtkWidget *object_hierarchy;
-
-  GtkWidget *widget_popup;
-
-  GtkWidget *selected_widget;
-  GtkWidget *flash_widget;
-
-  gint flash_count;
-  gint flash_cnx;
-
-} GtkInspectorWindow;
-
-typedef struct
-{
-  GtkWindowClass parent;
-} GtkInspectorWindowClass;
-
-
-G_BEGIN_DECLS
-
-GType      gtk_inspector_window_get_type    (void);
-GtkWidget *gtk_inspector_window_new         (void);
-
-void       gtk_inspector_flash_widget       (GtkInspectorWindow *iw,
-                                             GtkWidget      *widget);
-
-GtkWidget *gtk_inspector_inspect_button_new (GtkInspectorWindow *iw);
-
-G_END_DECLS
-
-
-#endif // _GTK_INSPECTOR_WINDOW_H_
-
-// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/window.ui b/modules/other/parasite/window.ui
deleted file mode 100644 (file)
index a1d7a45..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkImage" id="update_image">
-    <property name="visible">True</property>
-    <property name="icon-name">view-refresh</property>
-    <property name="icon-size">4</property>
-  </object>
-  <object class="GtkImage" id="inspect_image">
-    <property name="visible">True</property>
-    <property name="icon-name">edit-find</property>
-    <property name="icon-size">4</property>
-  </object>
-  <object class="GtkMenu" id="widget_popup">
-    <property name="visible">True</property>
-    <child>
-      <object class="GtkMenuItem">
-        <property name="visible">True</property>
-        <property name="label">Send Widget to Shell</property>
-        <signal name="activate" handler="on_send_widget_to_shell_activate"/>
-      </object>
-    </child>
-  </object>
-  <template class="GtkInspectorWindow" parent="GtkWindow">
-    <property name="default-height">500</property>
-    <property name="default-width">1000</property>
-    <child type="titlebar">
-      <object class="GtkHeaderBar">
-        <property name="visible">True</property>
-        <property name="show-close-button">True</property>
-        <child>
-          <object class="GtkBox">
-            <property name="visible">True</property>
-            <style>
-              <class name="linked"/>
-            </style>
-            <child>
-              <object class="GtkButton">
-                <property name="visible">True</property>
-                <property name="image">inspect_image</property>
-                <property name="tooltip-text">Inspect</property>
-                <signal name="clicked" handler="on_inspect"/>
-              </object>
-            </child>
-            <child>
-              <object class="GtkToggleButton">
-                <property name="visible">True</property>
-                <property name="image">update_image</property>
-                <property name="tooltip-text">Show Graphic Updates</property>
-                <signal name="toggled" handler="on_graphic_updates_toggled"/>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkNotebook">
-        <property name="visible">True</property>
-        <property name="show-border">False</property>
-        <child>
-          <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkInspectorButtonPath" id="button_path">
-                <property name="visible">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkPaned">
-                <property name="visible">True</property>
-                <property name="orientation">horizontal</property>
-                <child>
-                  <object class="GtkPaned">
-                    <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GtkScrolledWindow">
-                        <property name="visible">True</property>
-                        <property name="hscrollbar-policy">automatic</property>
-                        <property name="vscrollbar-policy">always</property>
-                        <property name="shadow-type">in</property>
-                        <property name="width-request">250</property>
-                        <property name="expand">True</property>
-                        <child>
-                          <object class="GtkInspectorWidgetTree" id="widget_tree">
-                            <property name="visible">True</property>
-                            <signal name="widget-changed" handler="on_widget_tree_selection_changed"/>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="resize">True</property>
-                        <property name="shrink">False</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkInspectorPythonShell" id="python_shell">
-                        <property name="visible">False</property>
-                      </object>
-                      <packing>
-                        <property name="resize">False</property>
-                        <property name="shrink">False</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="resize">True</property>
-                    <property name="shrink">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkNotebook">
-                    <property name="visible">True</property>
-                    <property name="enable-popup">True</property>
-                    <property name="show-border">False</property>
-                    <child>
-                      <object class="GtkScrolledWindow">
-                        <property name="visible">True</property>
-                        <property name="hscrollbar-policy">automatic</property>
-                        <property name="vscrollbar-policy">always</property>
-                        <property name="shadow-type">in</property>
-                        <property name="width-request">250</property>
-                        <child>
-                          <object class="GtkInspectorPropList" id="prop_list">
-                            <property name="visible">True</property>
-                            <property name="child-properties">False</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="tab">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="label">Properties</property>
-                      </object>
-                    </child> 
-                    <child>
-                      <object class="GtkScrolledWindow">
-                        <property name="visible">True</property>
-                        <property name="hscrollbar-policy">automatic</property>
-                        <property name="vscrollbar-policy">always</property>
-                        <property name="shadow-type">in</property>
-                        <property name="width-request">250</property>
-                        <child>
-                          <object class="GtkInspectorPropList" id="child_prop_list">
-                            <property name="visible">True</property>
-                            <property name="child-properties">True</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="tab">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="label">Child Properties</property>
-                      </object>
-                    </child> 
-                    <child>
-                      <object class="GtkInspectorObjectHierarchy" id="object_hierarchy">
-                        <property name="visible">True</property>
-                      </object>
-                    </child>
-                    <child type="tab">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="label">Hierarchy</property>
-                      </object>
-                    </child> 
-                    <child>
-                      <object class="GtkInspectorClassesList" id="classes_list">
-                        <property name="visible">True</property>
-                      </object>
-                    </child>
-                    <child type="tab">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="label">CSS Classes</property>
-                      </object>
-                    </child> 
-                    <child>
-                      <object class="GtkInspectorCssEditor" id="widget_css_editor">
-                        <property name="visible">True</property>
-                        <property name="global">False</property>
-                      </object>
-                    </child>
-                    <child type="tab">
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="label">Custom CSS</property>
-                      </object>
-                    </child> 
-                  </object>
-                  <packing>
-                    <property name="resize">True</property>
-                    <property name="shrink">True</property>
-                  </packing>
-                </child>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label">Widget Tree</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkInspectorThemes">
-            <property name="visible">True</property>
-          </object>
-        </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label">Themes</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkInspectorCssEditor">
-            <property name="visible">True</property>
-            <property name="global">True</property>
-          </object>
-        </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label">Custom CSS</property>
-          </object>
-        </child>
-      </object>
-    </child>
-  </template>
-</interface>